Thread overview
[OT] Three Optimization Tips for C++
Dec 20, 2012
Joshua Niehus
Dec 21, 2012
bearophile
Dec 21, 2012
Peter Alexander
Dec 24, 2012
Tove
Dec 21, 2012
Max Samukha
December 20, 2012
Vote up!

http://www.reddit.com/r/programming/comments/155ivw/three_optimization_tips_for_c_video/


Andrei
December 20, 2012
On Thursday, 20 December 2012 at 05:29:46 UTC, Andrei Alexandrescu wrote:
> Vote up!
>
http://www.reddit.com/r/programming/comments/155ivw/three_optimization_tips_for_c_video/
> Andrei

Almost 2 years ago, I stumbled across your book at a Barnes&Nobel and began my journey with D. It turns out its an "unsigned" copy.  Any chance you'll sign it at the DConf?
December 21, 2012
Andrei Alexandrescu:

> http://www.reddit.com/r/programming/comments/155ivw/three_optimization_tips_for_c_video/

I appreciate such slides and videos, thank you for sharing. But If possible I'd like a link to the slides in a place where I don't have to register to download them.

I have also just seen this other slides pack from Jordan DeLong, it is very interesting, it's about a topic that is usually regarded as one of the strongest points of functional languages (that is using types to "make illegal states unrepresentable"):

http://www.reddit.com/r/cpp/comments/1571m9/facebook_nyc_tech_talk_jordan_delong_using/

Bye,
bearophile
December 21, 2012
On Thursday, 20 December 2012 at 05:29:46 UTC, Andrei Alexandrescu wrote:
> Vote up!
>
> http://www.reddit.com/r/programming/comments/155ivw/three_optimization_tips_for_c_video/
>
>
> Andrei

I think the most interesting thing from that talk is when you said that Facebook's back end code is spending 15% of its time converting ints to strings.

I know you are looking at these small functions as simple examples of the optimisation tips you are giving, but I hope this isn't the kinds of optimisations you are doing at the Facebook. The problem isn't that the conversion is slow, the problem is that you are converting at all. Don't use text based formats for performance sensitive data!

Of course, maybe the 15% claim was pure exaggeration. I really hope that's the case.
December 21, 2012
On Thursday, 20 December 2012 at 05:29:46 UTC, Andrei Alexandrescu wrote:
> Vote up!
>
> http://www.reddit.com/r/programming/comments/155ivw/three_optimization_tips_for_c_video/
>
>
> Andrei

Nice talk. For anybody interested, PIC was made a bit faster by x64 due to introduction of RIP-relative addressing. Here is a concise and well-written article describing an x64 PIC implementation http://eli.thegreenplace.net/2011/11/11/position-independent-code-pic-in-shared-libraries-on-x64/.
December 21, 2012
On 12/21/12 7:23 AM, Peter Alexander wrote:
> On Thursday, 20 December 2012 at 05:29:46 UTC, Andrei Alexandrescu wrote:
>> Vote up!
>>
>> http://www.reddit.com/r/programming/comments/155ivw/three_optimization_tips_for_c_video/
>>
>>
>>
>> Andrei
>
> I think the most interesting thing from that talk is when you said that
> Facebook's back end code is spending 15% of its time converting ints to
> strings.

Not all back end code. Certain applications.

> I know you are looking at these small functions as simple examples of
> the optimisation tips you are giving, but I hope this isn't the kinds of
> optimisations you are doing at the Facebook. The problem isn't that the
> conversion is slow, the problem is that you are converting at all. Don't
> use text based formats for performance sensitive data!
>
> Of course, maybe the 15% claim was pure exaggeration. I really hope
> that's the case.

Text representation has its own advantages.


Andrei
December 24, 2012
On Friday, 21 December 2012 at 16:28:35 UTC, Andrei Alexandrescu wrote:
>> use text based formats for performance sensitive data!
>>
>> Of course, maybe the 15% claim was pure exaggeration. I really hope
>> that's the case.
>
> Text representation has its own advantages.
>
>
> Andrei

interesting, does it have to be base 10? would it not be feasible to use hex strings in some scenarios? possible with bswap, or bitscan etc?