Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selfhost: Gotta go fast(er) #1604

Merged
merged 3 commits into from
Nov 11, 2024
Merged

selfhost: Gotta go fast(er) #1604

merged 3 commits into from
Nov 11, 2024

Conversation

alimpfard
Copy link
Member

This speeds up find_or_add_type_id() using one major observation and
two observations:

  • A type does not change significantly once it's created
  • The type can have a more lax hash that ignores large parts of the
    type
  • There aren't that many types with the same lax hash actually

In this commit, the type list in a module gains a skiplist where each
"lane" is reserved for a specific hash; this list grows linearly with
the number of unique hashes, as each entry tracks its own next-in-list
object.

Overall, this is a ~40% performance increase when typechecking the
compiler, and a ~11% increase when typechecking all the tests in the
repository.

This speeds up find_or_add_type_id() using one major observation and
two observations:
  - A type does not change significantly once it's created
  - The type can have a more lax hash that ignores large parts of the
    type
  - There aren't that many types with the same lax hash actually

In this commit, the type list in a module gains a skiplist where each
"lane" is reserved for a specific hash; this list grows linearly with
the number of unique hashes, as each entry tracks its own next-in-list
object.

Overall, this is a ~40% performance increase when typechecking the
compiler, and a ~11% increase when typechecking all the tests in the
repository.
Writing these back to disk is slower than parsing the C++, and I don't
think they ever actually worked.
@alimpfard alimpfard merged commit 7c1a26b into SerenityOS:main Nov 11, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant