Skip to content

Tuning request: List access #89

Open
@ArnoHue

Description

@ArnoHue

Performance-profiling the GoK Chess project at https://turbowarp.org/148769358 via Google dev tools, it shows that a significant amount of time is spent on list items access, mostly listGet() and listReplace(), which in turn invoke listIndex().

I noticed that there is special handling required for string-based index parameters like "first", "last", "random", and expect this to be a main cause. I am no JavaScript expert, but was wondering whether there might be an alternative, e.g. passing the index parameter straight through in JavaScript, and only if the item turns out to be undefined, trigger special handling for string parameters. Or alternatively, detect those string constants during parsing, and generate special JavaScript code to cover the string index cases. This still leaves out dynamically passed strings, but that scenario should be extremely seldom. I suppose a Visitor pattern implementation might not be an option due to weak typing?

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