Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] A semi-related question
- Date: Mon, 25 Apr 2005 03:10:28 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] A semi-related question
- References: <47473.210.224.135.130.1113871266.squirrel@example.com><41131.206.39.111.20.1114091136.squirrel@example.com><32a656c205042107066a08c8ec@example.com><d8fcc08005042111506f52216d@example.com><48517.206.39.111.20.1114130561.squirrel@example.com><87zmvrtv7r.fsf@example.com><40226.206.39.111.20.1114140386.squirrel@example.com><87fyxjta9m.fsf@example.com><d8fcc080050422044772ad06d2@example.com><1093.202.33.108.34.1114172153.squirrel@example.com><d8fcc08005042210266fe64f2b@example.com>
- Organization: The XEmacs Project
- User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (cilantro, linux)
>>>>> "Josh" == Josh Glover <jmglov@example.com> writes: Josh> I think that you are right about g++, but not about gcc. I Josh> think gcc always honours "inline" when you turn on Josh> optimisation: [cites gcc manual] Nope. That's what -Winline is for, to let you know when GCC can't hack inlining something. Josh> On 4/22/05, Kenneth <emry@example.com> wrote: >> I don't use inline much personaly anyway. Then again my current >> programming skill is very minimal. ^^; Josh> In general, this is the correct approach. In all but the Josh> most extreme cases, the compiler knows better than you when Josh> something should be inlined. I believe on some systems the inline keyword causes the compiler to emit meta information that permits the linker to do inlining. (I don't know if any of them are actually in production, though.) Josh> Of course, when you do a lot of systems programming, over Josh> time, you encounter a lot of the corner cases where inlining Josh> something can make your subsystem an order of magnitude Josh> faster, but the compiler does not realise it. *That* is when Josh> you use the inline keyword. Unfortunately, it's generally not true that the compiler can hack inlining stuff that's complicated enough that it can't figure out that function call overhead is too high. For example, I once found a speedup that was of the form void /* this is crucial, of course */ dumbfunc (arg) { if (global_flag) { /* 100 lines of hairy expensive code including function calls */ } and I won big with #define dumbfunc(arg) do { if (global_flag) smartfunc (arg); } while (0) void smartfunc (arg) { /* 100 lines of hairy expensive code including function calls */ } I don't think there are any production compilers smart enough to move code out of a function like that. -- School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.
- Follow-Ups:
- Re: [tlug] A semi-related question
- From: Josh Glover
- References:
- [tlug] Keyboards
- From: ijw
- [tlug] A semi-related question
- From: Kenneth
- Re: [tlug] A semi-related question
- From: Uva Coder
- Re: [tlug] A semi-related question
- From: Josh Glover
- Re: [tlug] A semi-related question
- From: Kenneth
- Re: [tlug] A semi-related question
- From: Stephen J. Turnbull
- Re: [tlug] A semi-related question
- From: Kenneth
- Re: [tlug] A semi-related question
- From: Stephen J. Turnbull
- Re: [tlug] A semi-related question
- From: Josh Glover
- Re: [tlug] A semi-related question
- From: Kenneth
- Re: [tlug] A semi-related question
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] OT (MagLev & Expo-05
- Next by Date: Re: [tlug] OT (MagLev & Expo-05
- Previous by thread: Re: [tlug] A semi-related question
- Next by thread: Re: [tlug] A semi-related question
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links