Skip to content

performance and code generation questions #75

@dyoo

Description

@dyoo

What's faster?

M.e.push.apply(M.e, M.p.closedVals)

or

M.e.splice(M.e.length, 0, M.p.closedVals)


There are a lot of places where we're generating constant closure values:

M.e[M.e.length-1]=new RT.Closure(_61,1,[],"some-empty?");

I should lift these up, and refer to them by their lifted name. The only issue is to get the references right so that they exist before we reference them.

Same thing with default prompt tags. I see things like:

M.c.push(new RT.PromptFrame(_66,RT.DEFAULT_CONTINUATION_PROMPT_TAG));

which should be liftable.


The typechecked primitives should be changed from doing things like this:

M.e[M.e.length-1]=(RT.testArgument(M,"pair",RT.isPair,M.e[M.e.length-4],0,"cdr")).rest;

to more simple expressions. Pretend we have:

M.e[M.e.length-1]=(RT.checkedCdr(M.e[M.e.length-4]));

Calls to constant functions should be optimized. We're doing other silly things like

M.e.length+=1;
M.e[M.e.length-1]=new RT.Closure(_117,1,[],"first-tuple");
M.v=(RT.testArgument(M,"pair",RT.isPair,M.e[M.e.length-4],0,"cdr")).rest;
M.p=M.e[M.e.length-1];
M.e[M.e.length-1]=M.v;
M.a=1;
RT.checkClosureAndArity(M);
M.c.push(new RT.CallFrame(_162,M.p));

which should really be:

CONST_CLOSURE[...] = new RT.Closure(_117,1,[],"first-tuple");
...
M.e.length+=1;
M.p=CONST_CLOSURE[...];
M.e[M.e.length-1]=(RT.testArgument(M,"pair",RT.isPair,M.e[M.e.length-4],0,"cdr")).rest;
M.a=1;
RT.checkClosureAndArity(M);
M.c.push(new RT.CallFrame(_162,M.p));

Constant folding:

M.e.splice(M.e.length-(1+1),1);

should do the obvious constant folding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions