5 ms·
Could any of this be used to improve comiling speed in other languages?
by wehadfun 13y ago
Could any of this be used to improve comiling speed in other languages?
- pmr_ 13y agoWhich other languages use the C/C++ preprocessor? I've seen it used for generating data or other source code when a preprocessor comes in handy, but never as a full-fledged component of another language. I also think that a modern language that uses includes instead of modules is just outright insane.
- plorkyeran 13y agoObjective-C(++). I don't think obj-c changes anything about how the preprocessor works, so presumably it'll work fine for that. Using the C preprocessor in a non-superset-of-C language would be a pretty odd choice.
- duaneb 13y agoObjective-c introduced `#import`, which guards from double including by default. I would suspect and performance gains are tempered with a "pure" objc project.
- aidenn0 13y agoMany assemblers have the option to use the c preprocessor.
- nemetroid 13y agoThe Glasgow Haskell Compiler has a language pragma for running CPP before compilation. I've seen it used a few times, for #ifdef compatibility between Windows and Linux for low-level stuff. I don't think anyone would ever want to use #include or macros, so the issue of speed is not very interesting in that context. example: http://hackage.haskell.org/package/system-filepath-0.4.10/docs/src/Filesystem-Path-CurrentOS.html http://hackage.haskell.org/package/system-filepath-0.4.10/do...
- WalterBright 13y agoIt'll speed up any language that uses a separate C preprocessor. The same overall design could be used to implement many textual macro preprocessors, such as runoff, makefiles, etc.
- duaneb 13y agoCould you substantiate this claim? I don't necessarily not believe you, but it's an easy claim to make without any quantifiable argument. It's also hard to test against eg clang, where preprocessing is performed in the same process as the compiler and assembler, and the performance of a preprocessor is really less interesting than total compile time.
- WalterBright 13y agoAnything that uses a standard C preprocessor could use it, because it's a standard C preprocessor. I've written a couple of macro processing programs, including a make, so I know this kind of program can work with that.
- duaneb 13y agoLet me clarify—could you substantiate the performance claims? I have no doubt it's a correct preprocessor, but I do have doubts about performance claims in the context of the compilation of a project. cpp (and the rest of the gnu compiler toolchain) itself is a pretty terrible example of a well-written program, but clang is a well-written, holistic, performance-centered program, and it would strike me as difficult for an isolated preprocessor to improve significantly on it compared to the built in one. Or another way of putting this is—you speak compellingly about both the algorithm side and the constant side (no tokenizing), but you don't speak about "real world" performance when interacting with many levels of caches, processes, and filesystems. Could you speak to this at all?
- WalterBright 13y agoOther people in this thread have tested warp against both cpp and clang and posted numbers. BTW, of course if a preprocessor is integrated with another program, Warp can't replace it. It can replace standalone use of a preprocessor.