Skip to content

feat: improve cold start by generating map fixtures at build time #560

Open
@jlp-craigmorten

Description

@jlp-craigmorten

Something that strikes me as curious with this project's setup is the mix of build time code generation vs runtime map generation.

Namely, the ./scripts/breakUpAriaJSON.js enables the generation of role files, but when it comes to the maps: elementRoles, roleElement, and roles, these are generated at runtime.

Doing a very noddy bench test it looks like the generation of the above maps at runtime results in a cold start between 60-80ms when first requiring aria-query into a commonjs Node 18.20.3 project (M1 MacBook Pro 2021, 32GB RAM).

If instead the underlying map data is generated at build time as JSON (something we can do as there is no business logic in this project, just representations of static fixtures) and then just wrapped by the map facade the coldstart drops to ~6-7ms.

For many consumers an extra overhead at startup of ~50-70ms is probably a drop in the ocean, but at the scale this project is used there is some potential for wide scale good in reduced compute demand and improved start times?

Update: seems my naive bench from this morning can't be replicated, and now seeing cold start at ~30-40ms for the project as-is.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions