Replace type-id function with lookup table#15904
Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom Jul 2, 2025
Merged
Replace type-id function with lookup table#15904straight-shoota merged 1 commit intocrystal-lang:masterfrom
straight-shoota merged 1 commit intocrystal-lang:masterfrom
Conversation
ysbaddaden
approved these changes
Jun 16, 2025
Collaborator
ysbaddaden
left a comment
There was a problem hiding this comment.
This is pretty nice!
straight-shoota
approved these changes
Jun 16, 2025
1 task
straight-shoota
pushed a commit
that referenced
this pull request
Oct 25, 2025
#15904 made every LLVM module that references the `#as` pseudo-method define its own copy of `__crystal_type_id_to_class_name_map`, when only one copy in the main LLVM module is sufficient. This patch brings the total cache size of the compiler itself from 234 MB to 148 MB on my Windows machine, for example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #15708 codegen now generates a function mapping type-ids to strings.
This MR replaces this function with a const array, saving ca 7kB of binary size in a hello world application.
That's not really much in crystal terms, but it's simpler and should be easier to use for debugging purposes.