Optimization flags

Lantos István kerozin.joe at gmail.com
Fri Jul 8 21:10:04 UTC 2016


I made a non-scientific benchmark on my laptop with my project. Although
jumping from -O2 to -Ofast giving me dramatic speed boost, it's interesting
to see that going from gcc-4.9 to clang-3.9, there's no difference, just
margin of error. The test is non-scientific, I worked on my PC at midday on
raw pictures, lots of programs open, but still, those readings almost
identical.

My verdict is there's no reason to introduce clang into my Docker build,
because doesn't make any speed difference. Going from -O2 to -Ofast makes.
290-310req/s vs 380-450 req/s.

2016-07-08 15:22 GMT+02:00 Lantos István <kerozin.joe at gmail.com>:

> Thank You!
>
> 2016-07-08 15:20 GMT+02:00 Valentin V. Bartenev <vbart at nginx.com>:
>
>> On Friday 08 July 2016 14:44:00 Lantos István wrote:
>> > The default --with-cc-opt flags for Nginx are these:
>> >
>> > *--with-cc-opt='-g -O2 -fstack-protector-strong -Wformat
>> > > -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2'*
>> > >
>> >
>> > However I added more optimizations, which are against the standard:
>> >
>> > *--with-cc-opt='-g -Ofast -march=native -ffast-math
>> > > -fstack-protector-strong -Wformat -Werror=format-security
>> > > -Wp,-D_FORTIFY_SOURCE=2'*
>> > >
>> >
>> > So far I don't experience any bug, but I do have a higher benchmark:
>> > 380-450 req/s compared to the original 290-310 req/s with cached
>> > Node/Express app on my laptop.
>> >
>> > Is it safe to use -O3 or -Ofast flags with Nginx?
>>
>> Usually it is safe.  You can run tests: http://hg.nginx.org/nginx-tests/
>>
>> >
>> > Is it possible to build Nginx with clang? If so, should I symlink it to
>> gcc
>> > (I use Docker, this way gcc executable is trashed) or is there a way to
>> > define the compiler with a flag?
>>
>>   --with-cc=
>>
>>   wbr, Valentin V. Bartenev
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160708/0a568a87/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-vs-gcc.png
Type: image/png
Size: 54606 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160708/0a568a87/attachment.png>


More information about the nginx mailing list