binary_search, lower_bound and upper_bound inlining
Sun Apr 1 16:45:00 GMT 2007
Thanks for answering,
> >Is there something that I can do, other than editing the stl_algo.h file, in order to persuade
> >compiler to inline the binary_search, lower_bound and upper_bound algorithms? (even -O3 seems
> >good enough). Any chance for these algorithms to be inlined in the future GCC releases?
> we can definitely mark inline binary_search, very tiny, but frankly, for
> general use lower_bound and upper_bound seem too big and we risk a bad
> code bloat.
I suspected so :( That's life anyway...
> Can you measure a small improvement for binary_search alone?
By studding my measurements I suspect that binary_search is automatically inlined in -O3 (probably
because it is small). Anyway the "big fish" is lower_bound, binary_search is just more convenient
> In general, anyway, you should refer to the gcc manual, there are
> various knobs you can turn in order to change the behavior of the
> inliner (-finline-limit=...)
I found nothing appropriate in the manual. (-finline-limit works for functions that are explicitly
marked as inline)
Thank you very much,
ΓΓ‘Γ±Γ₯Γ¨ΓΓͺΓ‘Γ΄Γ₯ Γ΄Γ‘ Γ₯ΓΓ―Γ·Γ«Γ§Γ΄Γ©ΓͺΓ Γ¬Γ§ΓΓ½Γ¬Γ‘Γ΄Γ‘ (spam); ΓΓ― Yahoo! Mail
Γ€Γ©Γ‘Γ¨ΓΓ΄Γ₯Γ© Γ΄Γ§Γ ΓͺΓ‘Γ«Γ½Γ΄Γ₯Γ±Γ§ Γ€Γ΅ΓΓ‘Γ΄Γ Γ°Γ±Γ―Γ³Γ΄Γ‘Γ³ΓΓ‘ ΓͺΓ‘Γ΄Γ Γ΄ΓΉΓ Γ₯ΓΓ―Γ·Γ«Γ§Γ΄Γ©ΓͺΓΎΓ
More information about the Libstdc++