Skip to content

cfe: Slow constant evaluation for dart2js? #41979

Open
@rakudrama

Description

@rakudrama

Most of dart2js's 'Front end' task is spent in constant evaluation, in Constant _evaluateSubexpression(Expression node)
This accounts for 3-4% of total dart2js compile time.

Since half of the time is attributed to the re-throw, I suspect that using exceptions for control flow might be a contributing factor. It might still be the best approach.

Screenshot from 2020-05-19 22-13-10

I noticed is that the nodeCache is large - 1.6M entries in the program I was looking at. Nearly half the nodes passed to _evaluateSubexpression are ConstantExpression nodes. It should be possible to avoid entering most of these in the nodeCache - either the constant is directly available, or in some infrequent cases it is unevaluated, and the unevaluated expression can be used for the cache key. Another 10% are null and bool literals which could be handled trivially without caching.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions