[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optimising Elisp code
From: |
Emanuel Berg |
Subject: |
Re: Optimising Elisp code |
Date: |
Fri, 05 Oct 2018 19:23:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Óscar Fuentes wrote:
> Emanuel Berg <moasen@zoho.com> writes:
>
>> OK, in C++ it works like this: If a member
>> function is defined within the class
>> definition (not recommended), or if it is
>> defined outside of it (recommended) with the
>> word "inline" preceding the return type,
>> then the function becomes an inline
>> function. What this means is that when the
>> code is compiled into machine code, instead
>> of having one place for the function, and
>> jumping back and forth every time that
>> function is called, the machine code for the
>> inline function is placed, duplicated
>> wherever it is used. So you get longer
>> machine code, but faster, since there is
>> just constant execution for the inline
>> functions, without jumping back and forth.
>> When should it be used? If the function is
>> very short, say 1-3 lines, the jumping back
>> and forth requires more machine instructions
>> than the function itself. Then the
>> organizational gain of having it neatly at
>> one place is diminished by the speed
>> advantage of not having to jump back and
>> forth to that place all the time.
>
> Just in case any bystander finds this post:
> don't rely on anything that is mentioned
> above, nor for C++ `inline' keyword nor for
> code inlining in general.
I read it in this book:
@book{cpp-direkt,
author = {Jan Skansholm},
ISBN = {91-44-47931-X},
publisher = {Studentlitteratur},
title = {C++ direkt},
year = {1996}
}
--
underground experts united
http://user.it.uu.se/~embe8573
- Optimising Elisp code, Davin Pearson, 2018/10/04
- Re: Optimising Elisp code, Davin Pearson, 2018/10/04
- Re: Optimising Elisp code, tomas, 2018/10/05
- Re: Optimising Elisp code, Barry Margolin, 2018/10/05
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, Óscar Fuentes, 2018/10/05
- Message not available
- Re: Optimising Elisp code,
Emanuel Berg <=
- Re: Optimising Elisp code, Óscar Fuentes, 2018/10/05
- Message not available
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, Stefan Monnier, 2018/10/05
- Message not available
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, James K. Lowden, 2018/10/05
- Re: Optimising Elisp code, Emanuel Berg, 2018/10/05
- Re: Optimising Elisp code, Barry Margolin, 2018/10/06