On Monday 11 August 2008 16:10:24 luben karavelov wrote:

> What confuses me a lot is that r30125 change to core.ops just replaces
> "string_from_literal" with "const_string" on one line. I thought that
> const_string is faster because it doesn't need to allocate memory and
> produces less garbage. But it happens that it is a lot slower - it adds
> 11 seconds to the execution (with GC enabled).

You're not kidding.  I ran both through callgrind.  Here's without r30125:

        Events    : Ir
        I     refs: 27,538,484,782

        real    17m7.770s
        user    17m0.520s
        sys     0m3.912s

... and with:

        Events    : Ir
        I     refs: 42,179,373,817

        real    26m9.798s
        user    26m1.038s
        sys     0m6.224s

I hacked up an unclean way to make CONST_STRING work in core.ops, and it was a 
few thousand cycles faster than the const_string version.  That's disturbing, 
and well worth someone exploring for an explanation.  I've put up the 
relevant callgrind.out files for anyone who wants to poke around with 
callgrind or kcachegrind.

        http://www.wgz.org/chromatic/tmp/fib_string_from_literal.bz2
        http://www.wgz.org/chromatic/tmp/fib_const_string.bz2

-- c

Reply via email to