News for hackers. Stuff that matters.
Re:Warp, a fast preprocessor for C and C++ by WalterBright on Friday March 28, 2014 @04:15PM (#7489698)
>Using that to compile warp with gdc with the flags it suggests (-release is not recognized by gdc, -O3 is),

Andrei wrote on Reddit:

"We build warp at Facebook using gdc with -fno-bound-checks -frelease -O4."

http://www.reddit.com/r/programming/comments/21m0bz/warp_a_f...

Re:Warp, a fast preprocessor for C and C++ by DannyBee on Friday March 28, 2014 @04:20PM (#7489724)
This is not the set of flags you have in the makefile on github though. I would expect people to use those :)

In any case, building warp with this brings the timings down to 2.31 seconds, so clang is still 40% faster (1.41 vs 2.31)

In any case, at least on my side, i don't have time to further explore, i'd love to see cases where warp is faster, but i haven't found them.

(There is also a certain irony of saying you don't post numbers because you get accused, then saying i used the wrong flags, but ...)

Re:Warp, a fast preprocessor for C and C++ by WalterBright on Friday March 28, 2014 @04:39PM (#7489840)
Thanks for doing this. I have read that clang uses some SIMD instructions to speed this up, and I don't know how much that contributes. Warp doesn't use any inline assembler.

And, as your numbers show, suggesting the change in compiler flags was entirely justified.

Re:Warp, a fast preprocessor for C and C++ by DannyBee on Friday March 28, 2014 @04:58PM (#7489943)
the SIMD usage is mainly to do two things.

In the lexer, it is used for block comment skipping. It will find the end of block comments 16 characters at a time (on both PPC and x86).

During line number computation, it will also find newlines 16 characters at a time.

This could actually (nowadays) be done 32 characters at a time on newer processors, but isn't.

Re:Warp, a fast preprocessor for C and C++ by jfb on Friday March 28, 2014 @08:44PM (#7490914)
This is flat-out fascinating. Thanks.
Re:Warp, a fast preprocessor for C and C++ by WalterBright on Friday March 28, 2014 @05:55PM (#7490196)
I'm curious how much of an effect this has.
Re:Warp, a fast preprocessor for C and C++ by jevinskie on Friday March 28, 2014 @06:31PM (#7490364)
64 characters with AVX-512? =)
Re:Warp, a fast preprocessor for C and C++ by DannyBee on Friday March 28, 2014 @06:52PM (#7490475)
I didn't check to see if the instructions exist, but possibly :)

You do start to hit two issues though as oyu increase the size of the skipping:

1. Alignment 2. If the average block comment/line is < 64 characters, you may lose more time performing the instruction and then counting the trailing zeros in the result to find the place it ended.

I have no numbers to back up whether this matters, of course :)

Re:Warp, a fast preprocessor for C and C++ by pbsd on Friday March 28, 2014 @10:30PM (#7491180)
AVX-512 does not seem to have PMOVMSKB, which is how I assume it is being done with SSE2. There are other ways to skin that cat, but it's unclear whether they have any advantage over using AVX2 with VPMOVMSKB.
Re:Warp, a fast preprocessor for C and C++ by DannyBee on Sunday March 30, 2014 @12:38AM (#7495254)
I posted a patch here: https://gist.github.com/dberlin/9867614

It adds AVX2 and SSE4.2 instruction support. It makes no discernible difference performance wise that i can find :)

Re:Warp, a fast preprocessor for C and C++ by jevinskie on Monday March 31, 2014 @11:05AM (#7501881)
Heh, awesome! I'll try it out today.
Re:Warp, a fast preprocessor for C and C++ by WalterBright on Saturday March 29, 2014 @04:30AM (#7491757)
I forgot to ask - are you compiling Warp for a 64 bit executable? Use -m64 if you're not sure.