Skip to content

Conversation

@soutaro
Copy link
Member

@soutaro soutaro commented Sep 26, 2025

Extracted from #2652

The initialization of the mmap based allocator impacts parsing performance, if the parsing input is small. Switching to malloc based allocator improved the parsing performance.

Details

Baseline with lexer fix

➜  rbs git:(fix-lexer) bundle exec ruby bin/benchmark-parse.rb core/**/*.rbs ../../ruby/gem_rbs_collection/gems/activerecord/8.0/*.rbs sig/**/*.rbs
Benchmarking parsing 177 files...
✅ 16.667 i/s (±0.000%)

malloc based allocator

➜  rbs git:(allocator) ✗ bundle exec ruby bin/benchmark-parse.rb core/**/*.rbs ../../ruby/gem_rbs_collection/gems/activerecord/8.0/*.rbs sig/**/*.rbs
Benchmarking parsing 177 files...
✅ 19.726 i/s (±0.000%)

@soutaro soutaro added this to the RBS 4.0 milestone Sep 26, 2025
@soutaro soutaro enabled auto-merge September 26, 2025 07:49
@soutaro soutaro added this pull request to the merge queue Sep 26, 2025
Merged via the queue into master with commit ca77fde Sep 26, 2025
22 checks passed
@soutaro soutaro deleted the allocator branch September 26, 2025 08:05
@amomchilov
Copy link
Contributor

For the record, this is essentially a revert of #38, back to the rudimentary allocator initially introduced in #2398

soutaro added a commit that referenced this pull request Oct 6, 2025
Use `malloc` based allocator
@soutaro soutaro mentioned this pull request Oct 6, 2025
soutaro added a commit that referenced this pull request Oct 6, 2025
Use `malloc` based allocator
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.

3 participants