
On 08/06/10 16:16, Andy Venikov wrote:
John Bytheway wrote: <snip>
The down side with this approach, of course, is the absolutely massive compile-time cost. Compiling the above example with g++ 4.4.3 takes over 6 minutes and over 1.3GiB of memory (and this is after I've put in effort to optimize it). The time I could live with, but the memory requirements are absurd. Any lexer of real-world complexity would be quite impossible to compile.
Could you try it with gcc 4.3? 4.4 has a known regression when it comes to compiling meta-c++ code.
Here are some numbers for compiling one of my tests which contains the example I quoted and a couple of other relatively trivial examples. These numbers are reported by /usr/bin/time. The memory usage numbers are not at all accurate, but I think they're proportional to the truth. g++ 4.4.3: Elapsed (wall clock) time (h:mm:ss or m:ss): 7:01.17 Maximum resident set size (kbytes): 5298256 (as I said before, this really needs about 1.3GiB, not the 5GB reported) g++ 4.3.3: Elapsed (wall clock) time (h:mm:ss or m:ss): 9:38.92 Maximum resident set size (kbytes): 5390064 So 4.3 is worse on both counts. clang++ (svn HEAD): Elapsed (wall clock) time (h:mm:ss or m:ss): 0:15.59 Maximum resident set size (kbytes): 5806528 So clang is *much* faster than either g++, but uses even more memory (this number translates as a little over 1.5GiB in real terms). John Bytheway