warp: a fast C and C++ preprocessor
Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. http://www.reddit.com/r/programming/comments/21m0bz/warp_a_fast_c_and_c_preprocessor/ https://news.ycombinator.com/newest https://twitter.com/fbOpenSource/status/449611378219679744 https://www.facebook.com/dlang.org/posts/10202207506322611?stream_ref=10 Andrei
Re: warp: a fast C and C++ preprocessor
On 3/28/2014 11:27 AM, Andrei Alexandrescu wrote: https://news.ycombinator.com/newest It was posted around 11:20 PST, if that helps find it in the morass of new postings.
Re: warp: a fast C and C++ preprocessor
Am 28.03.2014 19:27, schrieb Andrei Alexandrescu: Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. http://www.reddit.com/r/programming/comments/21m0bz/warp_a_fast_c_and_c_preprocessor/ https://news.ycombinator.com/newest https://twitter.com/fbOpenSource/status/449611378219679744 https://www.facebook.com/dlang.org/posts/10202207506322611?stream_ref=10 Andrei Just read the article. Quite interesting. Congratulations! Paulo
Re: warp: a fast C and C++ preprocessor
On Friday, 28 March 2014 at 18:27:17 UTC, Andrei Alexandrescu wrote: Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. http://www.reddit.com/r/programming/comments/21m0bz/warp_a_fast_c_and_c_preprocessor/ https://news.ycombinator.com/newest https://twitter.com/fbOpenSource/status/449611378219679744 https://www.facebook.com/dlang.org/posts/10202207506322611?stream_ref=10 Andrei Is Warp written in D? I don't think it was made clear in the article.
Re: warp: a fast C and C++ preprocessor
On Friday, 28 March 2014 at 19:19:03 UTC, Meta wrote: On Friday, 28 March 2014 at 18:27:17 UTC, Andrei Alexandrescu wrote: Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. http://www.reddit.com/r/programming/comments/21m0bz/warp_a_fast_c_and_c_preprocessor/ https://news.ycombinator.com/newest https://twitter.com/fbOpenSource/status/449611378219679744 https://www.facebook.com/dlang.org/posts/10202207506322611?stream_ref=10 Andrei Is Warp written in D? I don't think it was made clear in the article. It's clear when you read the full interview :/ Anyway congratulations, this is a great proof of D's power, and also a nice vote of confidence from Facebook :)
Re: warp: a fast C and C++ preprocessor
On Friday, 28 March 2014 at 19:36:02 UTC, Théo Bueno wrote: It's clear when you read the full interview :/ Anyway congratulations, this is a great proof of D's power, and also a nice vote of confidence from Facebook :) I read quickly through the interview, and although they talked quite a bit about D, I never saw it specifically mentioned that Warp is written in D.
Re: warp: a fast C and C++ preprocessor
On Fri, 28 Mar 2014 19:46:48 +, Meta wrote: > On Friday, 28 March 2014 at 19:36:02 UTC, Théo Bueno wrote: >> It's clear when you read the full interview :/ >> Anyway congratulations, this is a great proof of D's power, and also a >> nice vote of confidence from Facebook :) > > I read quickly through the interview, and although they talked quite a > bit about D, I never saw it specifically mentioned that Warp is written > in D. The very first link in the article is the github repository of source files, all of which are written in D. --jjs
Re: warp: a fast C and C++ preprocessor
On Friday, 28 March 2014 at 19:57:06 UTC, John Stahara wrote: The very first link in the article is the github repository of source files, all of which are written in D. --jjs Yes, here: https://github.com/facebook/warp Matheus.
Re: warp: a fast C and C++ preprocessor
On 03/28/2014 11:27 AM, Andrei Alexandrescu wrote: > Facebook is open-sourcing warp, a fast C and C++ preprocessor It could be useful for me just this past week in a throw-away D program that I wrote (at work! :) ) to parse some C and C++ files very crudely. Ali
Re: warp: a fast C and C++ preprocessor
This is awesome news, congrats! I hadn't thought of the possibility of Walter doing some work for Facebook. Between this and the Oculus VR buyout, Facebook keeps doing interesting stuff. This should surely be good for D.
Re: warp: a fast C and C++ preprocessor
On Friday, 28 March 2014 at 21:18:52 UTC, w0rp wrote: This is awesome news, congrats! I hadn't thought of the possibility of Walter doing some work for Facebook. Between this and the Oculus VR buyout, Facebook keeps doing interesting stuff. This should surely be good for D. If John Carmack is a Facebook employee, and D gains greater traction within Facebook, there is a real possibility that John Carmack might end up working in D for some small project, which would be a huge endorsement. He's already aware of it, at the very least, citing D's approach to purity in an old blog post.
Re: warp: a fast C and C++ preprocessor
On 3/28/2014 2:27 PM, Andrei Alexandrescu wrote: Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. http://www.reddit.com/r/programming/comments/21m0bz/warp_a_fast_c_and_c_preprocessor/ Y'know, I've never been much of a fan of social networking sites, centralized/walled internet services, or being bombarded with "Find/like/etc us on Fb/Tw!" from every company around...*However*, regardless of my interest level in their flagship service, things like this and other D-related things (and also their new alternative-to-PHP language) are genuinely improving my opinion of Facebook as a company. Kudos! (Note: *Not* intended as a backhanded-complement. Just the regular kind of complement.)
Re: warp: a fast C and C++ preprocessor
On 03/28/2014 02:40 PM, Nick Sabalausky wrote: > improving my opinion of Facebook as a company. > Kudos! Hearing that from you is proof enough that Facebook is playing it right. ;) Ali
Re: warp: a fast C and C++ preprocessor
On 3/28/14, 12:19 PM, Meta wrote: Is Warp written in D? I don't think it was made clear in the article. We wanted to be subdued about it and focus on the technical discussion instead of making it seem like an ad for D. Of course that still wasn't enough for someone on hackernews... https://news.ycombinator.com/item?id=7489160 Andrei
Re: warp: a fast C and C++ preprocessor
On Friday, 28 March 2014 at 18:27:17 UTC, Andrei Alexandrescu wrote: Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. http://www.reddit.com/r/programming/comments/21m0bz/warp_a_fast_c_and_c_preprocessor/ https://news.ycombinator.com/newest https://twitter.com/fbOpenSource/status/449611378219679744 https://www.facebook.com/dlang.org/posts/10202207506322611?stream_ref=10 Andrei All I can say is two things. One I'm annoyed because I've been working on a macro preprocessor the last week or so and just got it up to supporting #if's anding and oring with defines. Oh well. Second great work on collaborating with Facebook. Definitely a great thing going on here!
Re: warp: a fast C and C++ preprocessor
On Friday, 28 March 2014 at 21:16:29 UTC, Ali Çehreli wrote: It could be useful for me just this past week in a throw-away D program that I wrote (at work! :) ) to parse some C and C++ files very crudely. As I understand, a preprocessor works on macros only, the rest is lexed minimally.
Re: warp: a fast C and C++ preprocessor
On 3/30/2014 10:08 AM, Kagamin wrote: On Friday, 28 March 2014 at 21:16:29 UTC, Ali Çehreli wrote: It could be useful for me just this past week in a throw-away D program that I wrote (at work! :) ) to parse some C and C++ files very crudely. As I understand, a preprocessor works on macros only, the rest is lexed minimally. Yes, it won't help much with the rest.
Re: warp: a fast C and C++ preprocessor
On Sunday, 30 March 2014 at 19:28:20 UTC, Walter Bright wrote: On 3/30/2014 10:08 AM, Kagamin wrote: On Friday, 28 March 2014 at 21:16:29 UTC, Ali Çehreli wrote: It could be useful for me just this past week in a throw-away D program that I wrote (at work! :) ) to parse some C and C++ files very crudely. As I understand, a preprocessor works on macros only, the rest is lexed minimally. Yes, it won't help much with the rest. Were those ycombinator performance figures putting warp someway behind clang valid? Perhaps we should unleash a community effort to match clang?
Re: warp: a fast C and C++ preprocessor
On 3/30/14, ixid wrote: > Perhaps we should unleash a community effort to match clang? Sounds like wasted effort, why improve tools for parsing C++ instead of improving tools for parsing D?
Re: warp: a fast C and C++ preprocessor
On Sunday, 30 March 2014 at 20:43:52 UTC, Andrej Mitrovic wrote: On 3/30/14, ixid wrote: Perhaps we should unleash a community effort to match clang? Sounds like wasted effort, why improve tools for parsing C++ instead of improving tools for parsing D? It's good advertising for D, in a few ways: 1. C++ devs looking for faster compiles will learn about warp, and learn about D. 2. It shows that D is being used successfully in real projects. 3. It shows that D lives up to its performance claims.
Re: warp: a fast C and C++ preprocessor
On 3/30/2014 1:04 PM, ixid wrote: Were those ycombinator performance figures putting warp someway behind clang valid? I presume so, as the figures for how Warp was faster than gnu cpp were comparable to what Andrei and I measured.
Re: warp: a fast C and C++ preprocessor
On 3/30/14, Peter Alexander wrote: > 3. It shows that D lives up to its performance claims. Maybe. But there's a sore thumb in that codebase: GC.disable(); And that will do exactly the opposite for its performance claims (with regards to advertising it).
Re: warp: a fast C and C++ preprocessor
On 3/30/2014 2:15 PM, Andrej Mitrovic wrote: Maybe. But there's a sore thumb in that codebase: GC.disable(); And that will do exactly the opposite for its performance claims (with regards to advertising it). Not really. It proves that you can absolutely get work done in D without using the GC.
Re: warp: a fast C and C++ preprocessor
On 3/30/14, Walter Bright wrote: > Not really. It proves that you can absolutely get work done in D without > using the GC. But D has to prove that you can get work done *with* using the GC. So warp really sends the opposite message.
Re: warp: a fast C and C++ preprocessor
On 3/30/2014 3:07 PM, Andrej Mitrovic wrote: But D has to prove that you can get work done *with* using the GC. No matter how good the GC is, the word "GC" turns away a lot of programmers with a knee-jerk response. I aimed to show that one can write effective D programs without using the GC.
Re: warp: a fast C and C++ preprocessor
ixid, el 30 de March a las 20:04 me escribiste: > On Sunday, 30 March 2014 at 19:28:20 UTC, Walter Bright wrote: > >On 3/30/2014 10:08 AM, Kagamin wrote: > >>On Friday, 28 March 2014 at 21:16:29 UTC, Ali Çehreli wrote: > >>>It could be useful for me just this past week in a throw-away > >>>D program that I > >>>wrote (at work! :) ) to parse some C and C++ files very > >>>crudely. > >> > >>As I understand, a preprocessor works on macros only, the rest > >>is lexed minimally. > > > >Yes, it won't help much with the rest. > > Were those ycombinator performance figures putting warp someway > behind clang valid? Perhaps we should unleash a community effort to > match clang? I think that's pretty wasteful, why won't you just use clang? What's the point of competing with another opensource project (a very good one, that took a lot of men-hour to do a good C/C++ compiler, including the preprocessor). I understand Walter did this in a couple of weeks, clang have been developed for at least 7 years now, is totally understandable that clang outperforms warp, is enough merit for warp to outperform GCC. I mean, if someone wants to have fun, go ahead, but putting community effort on that where there are so many places that are more important to put the effort on seems a bit silly. -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ -- Debemos creer en los sueños del niño. Cuando el niño sueña con tetas, se toca. -- Ricardo Vaporeso. Toulouse, 1915.
Re: warp: a fast C and C++ preprocessor
On 03/30/2014 04:58 PM, Peter Alexander wrote: On Sunday, 30 March 2014 at 20:43:52 UTC, Andrej Mitrovic wrote: On 3/30/14, ixid wrote: Perhaps we should unleash a community effort to match clang? Sounds like wasted effort, why improve tools for parsing C++ instead of improving tools for parsing D? It's good advertising for D, in a few ways: 1. C++ devs looking for faster compiles will learn about warp, and learn about D. 2. It shows that D is being used successfully in real projects. 3. It shows that D lives up to its performance claims. +1
Re: warp: a fast C and C++ preprocessor
On Monday, 31 March 2014 at 00:09:34 UTC, Leandro Lucarella wrote: I think that's pretty wasteful, why won't you just use clang? What's the point of competing with another opensource project (a very good one, that took a lot of men-hour to do a good C/C++ compiler, including the preprocessor). I understand Walter did this in a couple of weeks, clang have been developed for at least 7 years now, is totally understandable that clang outperforms warp, is enough merit for warp to outperform GCC. I mean, if someone wants to have fun, go ahead, but putting community effort on that where there are so many places that are more important to put the effort on seems a bit silly. Walter taking 2 weeks to do something comparable to what the clang and gcc guys have done over many years, serves as massive advertising for D. Also, here we now have an entire project written by the man himself. That should serve as required reading for anybody who wants to learn how to code in the latest D. And it serves as a benchmark for the best C++ coders. They can try to do the same in C++ in two weeks. (I bet by the end of the two weeks the guys are ready to switch languages!)
Re: warp: a fast C and C++ preprocessor
On Monday, 31 March 2014 at 03:25:37 UTC, justme wrote: On Monday, 31 March 2014 at 00:09:34 UTC, Leandro Lucarella wrote: I mean, if someone wants to have fun, go ahead, but putting community effort on that where there are so many places that are more important to put the effort on seems a bit silly. Agreed. Walter taking 2 weeks to do something comparable to what the clang and gcc guys have done over many years, serves as massive advertising for D. Maybe, but sober observers will realize that Walter could probably have done something similar in C++. That doesn't negate your point though, that it's a good ad for D. Also, here we now have an entire project written by the man himself. That should serve as required reading for anybody who wants to learn how to code in the latest D. I made a first pass through. I notice that almost every 'alias' is of the form alias existing_name new_name; I thought that in the latest D the alias syntax was alias new_name = existing_name; Should I be following Walter's lead with respect to alias?
Re: warp: a fast C and C++ preprocessor
On 31/03/14 06:56, Brian Rogoff wrote: I made a first pass through. I notice that almost every 'alias' is of the form alias existing_name new_name; I thought that in the latest D the alias syntax was alias new_name = existing_name; Should I be following Walter's lead with respect to alias? No, use the new syntax. -- /Jacob Carlborg
Re: warp: a fast C and C++ preprocessor
On Sunday, 30 March 2014 at 20:43:52 UTC, Andrej Mitrovic wrote: Sounds like wasted effort, why improve tools for parsing C++ instead of improving tools for parsing D? If the lexer is the culprit (though there's no proof for it), improving C lexer can help improve D lexer.
Re: warp: a fast C and C++ preprocessor
On 3/30/14, 5:01 PM, Leandro Lucarella wrote: ixid, el 30 de March a las 20:04 me escribiste: On Sunday, 30 March 2014 at 19:28:20 UTC, Walter Bright wrote: On 3/30/2014 10:08 AM, Kagamin wrote: On Friday, 28 March 2014 at 21:16:29 UTC, Ali Çehreli wrote: It could be useful for me just this past week in a throw-away D program that I wrote (at work! :) ) to parse some C and C++ files very crudely. As I understand, a preprocessor works on macros only, the rest is lexed minimally. Yes, it won't help much with the rest. Were those ycombinator performance figures putting warp someway behind clang valid? Perhaps we should unleash a community effort to match clang? I think that's pretty wasteful, why won't you just use clang? What's the point of competing with another opensource project (a very good one, that took a lot of men-hour to do a good C/C++ compiler, including the preprocessor). I understand Walter did this in a couple of weeks, clang have been developed for at least 7 years now, is totally understandable that clang outperforms warp, is enough merit for warp to outperform GCC. I mean, if someone wants to have fun, go ahead, but putting community effort on that where there are so many places that are more important to put the effort on seems a bit silly. It's quite obvious. The D codebase is smaller and simpler than clang pp's and can be taken many places; the next thing I'll work on is multithreaded preprocessing that shares already opened files. One thing that is self-evident but the article could have stressed is that open-sourcing warp is the beginning, not the end of its lifecycle. There's a lot of improvements that are within easy reach for warp, and are easier to realize than for clang. Andrei
Re: warp: a fast C and C++ preprocessor
On Monday, 31 March 2014 at 14:46:32 UTC, Andrei Alexandrescu wrote: It's quite obvious. The D codebase is smaller and simpler than clang pp's and can be taken many places; the next thing I'll work on is multithreaded preprocessing that shares already opened files. One thing that is self-evident but the article could have stressed is that open-sourcing warp is the beginning, not the end of its lifecycle. There's a lot of improvements that are within easy reach for warp, and are easier to realize than for clang. Andrei We also have the ability to present it in a different use-case, pre-processing every header in one invocation, allowing warp to do some optimizations that Clang and GCC won't do, such as unconditional pre-processing (stripping comments and things such as #if 0 / #if 1, or conditions that are unconditionally met by things defined within the header, typically used to disable/enable certain code) because they would be of very limited use to GCC and Clang, which are typically invoked once for every source file. Warp could also offer the ability to pass certain #define's that are known to never be #undef'd by the source code (such as compiler capabilities / version identifications), allowing for more extensive unconditional pre-processing.
Re: warp: a fast C and C++ preprocessor
Am 28.03.2014 19:27, schrieb Andrei Alexandrescu: Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. currently any ideas why clang could be 40% faster? https://news.ycombinator.com/item?id=7489724
Re: warp: a fast C and C++ preprocessor
On Monday, 31 March 2014 at 17:11:48 UTC, dennis luehring wrote: Am 28.03.2014 19:27, schrieb Andrei Alexandrescu: Facebook is open-sourcing warp, a fast C and C++ preprocessor written by Walter Bright. currently any ideas why clang could be 40% faster? https://news.ycombinator.com/item?id=7489724 SIMD and virtual-file-system?
Re: warp: a fast C and C++ preprocessor
justme, el 31 de March a las 03:25 me escribiste: > On Monday, 31 March 2014 at 00:09:34 UTC, Leandro Lucarella wrote: > >I think that's pretty wasteful, why won't you just use clang? > >What's the > >point of competing with another opensource project (a very good > >one, > >that took a lot of men-hour to do a good C/C++ compiler, including > >the > >preprocessor). I understand Walter did this in a couple of weeks, > >clang > >have been developed for at least 7 years now, is totally > >understandable > >that clang outperforms warp, is enough merit for warp to > >outperform GCC. > >I mean, if someone wants to have fun, go ahead, but putting > >community > >effort on that where there are so many places that are more > >important to > >put the effort on seems a bit silly. > > Walter taking 2 weeks to do something comparable to what the clang > and gcc guys have done over many years, serves as massive > advertising for D. > > Also, here we now have an entire project written by the man himself. > That should serve as required reading for anybody who wants to learn > how to code in the latest D. > > And it serves as a benchmark for the best C++ coders. They can try > to do the same in C++ in two weeks. (I bet by the end of the two > weeks the guys are ready to switch languages!) Don't take the "couple of weeks" too literally, this is just my impression after reading the article! Maybe it would be good if Walter said how much time did it take him to code this. -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ -- Pack and get dressed before your father hears us, before all hell breaks loose.
Re: warp: a fast C and C++ preprocessor
Andrei Alexandrescu, el 31 de March a las 07:46 me escribiste: > On 3/30/14, 5:01 PM, Leandro Lucarella wrote: > >ixid, el 30 de March a las 20:04 me escribiste: > >>On Sunday, 30 March 2014 at 19:28:20 UTC, Walter Bright wrote: > >>>On 3/30/2014 10:08 AM, Kagamin wrote: > On Friday, 28 March 2014 at 21:16:29 UTC, Ali Çehreli wrote: > >It could be useful for me just this past week in a throw-away > >D program that I > >wrote (at work! :) ) to parse some C and C++ files very > >crudely. > > As I understand, a preprocessor works on macros only, the rest > is lexed minimally. > >>> > >>>Yes, it won't help much with the rest. > >> > >>Were those ycombinator performance figures putting warp someway > >>behind clang valid? Perhaps we should unleash a community effort to > >>match clang? > > > >I think that's pretty wasteful, why won't you just use clang? What's the > >point of competing with another opensource project (a very good one, > >that took a lot of men-hour to do a good C/C++ compiler, including the > >preprocessor). I understand Walter did this in a couple of weeks, clang > >have been developed for at least 7 years now, is totally understandable > >that clang outperforms warp, is enough merit for warp to outperform GCC. > >I mean, if someone wants to have fun, go ahead, but putting community > >effort on that where there are so many places that are more important to > >put the effort on seems a bit silly. > > It's quite obvious. The D codebase is smaller and simpler than clang > pp's and can be taken many places; the next thing I'll work on is > multithreaded preprocessing that shares already opened files. One > thing that is self-evident but the article could have stressed is > that open-sourcing warp is the beginning, not the end of its > lifecycle. There's a lot of improvements that are within easy reach > for warp, and are easier to realize than for clang. Honestly, I'm not so sure, Clang is modern and has been designed with extensibility and performance from day 0. I think it will be quite hard to compete with it and I wonder why are you willing to spend that much effort instead of contributing to Clang. If you said that about GCC, I could agree, but with Clang, at least for me, is harder to sell that argument. -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ -- MP: Cómo está, estimado Bellini? B: Muy bien, Mario, astrologando. MP: Qué tengo? B: Un balcón-terraza. MP: No, en mi mano, Bellini... B: Un secarropas! MP: No, escuche bien, eh. TieneB: El circo de Moscú. números. MP: No Bellini. Toma medidas. B: Un ministro. MP: No Bellini, eh! Algunas sonB: Una modelo, Mario! de plástico y otras de madera. MP: No, Bellini, no y no! -- El Gran Bellini (Mario Podestá con una regla)
Re: warp: a fast C and C++ preprocessor
On 3/31/2014 10:50 AM, Leandro Lucarella wrote: Don't take the "couple of weeks" too literally, this is just my impression after reading the article! Maybe it would be good if Walter said how much time did it take him to code this. I spent 2 weeks on the initial version, and another week tuning it. Since then, I've fixed a handful of bugs, but that didn't amount to much time.
Re: warp: a fast C and C++ preprocessor
Walter Bright: Since then, I've fixed a handful of bugs, but that didn't amount to much time. Have you kept a list of such bugs/mistakes of yours for warp? It is an interesting list. Bye, bearophile
Re: warp: a fast C and C++ preprocessor
On 3/31/2014 2:06 PM, bearophile wrote: Walter Bright: Since then, I've fixed a handful of bugs, but that didn't amount to much time. Have you kept a list of such bugs/mistakes of yours for warp? It is an interesting list. It's on github, though currently in a private repository. They were the usual mix of stupid coding mistakes and adjustments needed to match cpp's behavior.
Re: warp: a fast C and C++ preprocessor
On Monday, 31 March 2014 at 21:16:47 UTC, Walter Bright wrote: On 3/31/2014 2:06 PM, bearophile wrote: Walter Bright: Since then, I've fixed a handful of bugs, but that didn't amount to much time. Have you kept a list of such bugs/mistakes of yours for warp? It is an interesting list. It's on github, though currently in a private repository. They were the usual mix of stupid coding mistakes and adjustments needed to match cpp's behavior. I gave it a whirl on OSX Mavericks, Xcode 5.1 Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) a.cc contains only: #include $ ./warpdrive_clang3_4 -I /usr/include a.cc >~/a.pp /usr/include/stdlib.h(92) : identifier expected after 'defined' #if !__DARWIN_NO_LONG_LONG <-- line 92 typedef struct { long long quot; long long rem; } lldiv_t; #endif /* !__DARWIN_NO_LONG_LONG */