LWN.net Logo

Russell: GCC and C vs C++ Speed, Measured

Russell: GCC and C vs C++ Speed, Measured

Posted Mar 22, 2013 18:47 UTC (Fri) by daney (subscriber, #24551)
In reply to: Russell: GCC and C vs C++ Speed, Measured by nix
Parent article: Russell: GCC and C vs C++ Speed, Measured

Except there was no abstraction other than that that is possible to achieve using the C language. So this test doesn't even try to measure any hypothetical Abstraction Penalty that may be incurred by using C++ features.


(Log in to post comments)

Russell: GCC and C vs C++ Speed, Measured

Posted Mar 22, 2013 19:10 UTC (Fri) by nix (subscriber, #2304) [Link]

I'm fairly sure (OK, certain) that actual C++ code has already landed in 4.8 (see e.g. gcc/hash_table.* on the 4.8 branch). That makes it a test of the abstraction penalty imposed on the optimizer by those classes (in effect, nil). (Admittedly, quite a lot of that is probably because of -fno-exceptions, which eliminates a huge bunch of abnormal edges that *would* otherwise impede optimization even of code that looks just like C code. I should do some tests with -fexceptions and see how much effect this actually has...)

Russell: GCC and C vs C++ Speed, Measured

Posted Mar 22, 2013 21:10 UTC (Fri) by daney (subscriber, #24551) [Link]

The test was not with GCC 4.8, so it cannot be used to make assertions about Abstraction Penalties imposed by the GCC 4.8 code base.

Russell: GCC and C vs C++ Speed, Measured

Posted Mar 23, 2013 8:57 UTC (Sat) by nix (subscriber, #2304) [Link]

Wasn't it?

... oh hell, it says as much right in the excerpt, and I misread it at least three times. Sigh. Brain failure. You're right, of course.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds