Conversation
yogsototh
approved these changes
Aug 29, 2025
Contributor
There was a problem hiding this comment.
I checked with criterium, this is slightly faster, not sure however how to check if this will use more or less memory.
Edit: I could test:
Initial used heap: 61.1 MiB (1.5%)
│
│ (scopula.core-bench/t <184 B>) | Heap: +504 B (+0.0%)
│ │
│ │ (scopula.core/is-sub-list? <416 B> <416 B>) | Heap: +21.8 KiB (+0.0%)
│ │ │
│ │ └─→ <16 B> | Heap: +35.1 KiB (+0.0%)
│ │
│ └─→ <16 B> | Heap: +34.8 KiB (+0.0%)
Final used heap: +34.7 KiB (+0.0%)
The new version:
Initial used heap: 61.2 MiB (1.5%)
│
│ (scopula.core-bench/t <192 B>) | Heap: +456 B (+0.0%)
│ │
│ │ (scopula.core-bench/is-sub-list-2 <416 B> <416 B>) | Heap: +3.5 KiB (+0.0%)
│ │ │
│ │ └─→ <16 B> | Heap: +9.4 KiB (+0.0%)
│ │
│ └─→ <16 B> | Heap: +9.8 KiB (+0.0%)
Final used heap: +9.7 KiB (+0.0%)
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.
During our load tests we noticed heavy memory usage for both
is-sub-list?andrepr-is-subscope?.while their implementation is perfectly readable and favors maintenability, we can slightly tweak them to improve performance, this is an attempt at it, keeping a conservative approach while slightly tunning the code to reduce the memory footprint.