Higgs, a JavaScript JIT done in D

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Feb 5 11:01:19 PST 2013


On 2/5/13, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> Care for a shotgun search/replace pull request?

Looking at the implementation:

string text(T...)(T args)
{
    return textImpl!string(args);
}

private S textImpl(S, U...)(U args)
{
    S result;
    foreach (i, arg; args)
    {
        result ~= to!S(args[i]);
    }
    return result;
}

I can see 2 optimizations here:

1. Use a static if to replace the append operator with a simple return
when there's only one argument
2. Use Appender instead of a regular string for multiple arguments.

Unfortunately #2 won't fly because std.regex uses text and it expects
it to be safe, but Appender isn't safe.


More information about the Digitalmars-d-announce mailing list