Skip to content

inline Gc::inner_ptr#4317

Merged
jedel1043 merged 2 commits intoboa-dev:mainfrom
cijiugechu:inline-inner-ptr
Jul 4, 2025
Merged

inline Gc::inner_ptr#4317
jedel1043 merged 2 commits intoboa-dev:mainfrom
cijiugechu:inline-inner-ptr

Conversation

@cijiugechu
Copy link
Contributor

While profiling combined.js, I noticed that the function Gc::inner_ptr had a significantly higher overhead(2.57%) compared to the inner function (finalizer_safe)(0.35%). So I attempted to inline it. After reprofiling, the overhead indeed decreased (though not by much - 1.87%), and the overall performance of the program improved as well.

Comparison:

main:

PROGRESS Richards
RESULT Richards 105
PROGRESS DeltaBlue
RESULT DeltaBlue 108
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 118
PROGRESS RayTrace
RESULT RayTrace 255
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 297
PROGRESS RegExp
RESULT RegExp 59.5
PROGRESS Splay
RESULT Splay 420
PROGRESS NavierStokes
RESULT NavierStokes 268
SCORE 169
undefined

image

PR:

PROGRESS Richards
RESULT Richards 116
PROGRESS DeltaBlue
RESULT DeltaBlue 118
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 123
PROGRESS RayTrace
RESULT RayTrace 273
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 313
PROGRESS RegExp
RESULT RegExp 61.4
PROGRESS Splay
RESULT Splay 314
PROGRESS NavierStokes
RESULT NavierStokes 277
SCORE 172
undefined

image

@codecov
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.23%. Comparing base (6ddc2b4) to head (48ecb46).
Report is 454 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4317      +/-   ##
==========================================
+ Coverage   47.24%   50.23%   +2.98%     
==========================================
  Files         476      495      +19     
  Lines       46892    49591    +2699     
==========================================
+ Hits        22154    24911    +2757     
+ Misses      24738    24680      -58     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jedel1043
Copy link
Member

Nice catch!

I'm curious if the performance changes when we remove the assert below. Can you check that? Maybe we could potentially change it to a debug_assert if it seems to change perf a lot.

@jedel1043 jedel1043 added A-Performance Performance related changes and issues C-GC Issue related to garbage collection labels Jul 3, 2025
@jedel1043 jedel1043 added this to the next-release milestone Jul 3, 2025
@cijiugechu
Copy link
Contributor Author

Nice catch!

I'm curious if the performance changes when we remove the assert below. Can you check that? Maybe we could potentially change it to a debug_assert if it seems to change perf a lot.

I tried replacing assert with debug_assert, and the results of most benchmarks didn't change much. However, Splay seems to be an exception—it achieved a significant improvement! (from 420 to 470).

Result:

PROGRESS Richards
RESULT Richards 117
PROGRESS DeltaBlue
RESULT DeltaBlue 120
PROGRESS Encrypt
PROGRESS Decrypt
RESULT Crypto 122
PROGRESS RayTrace
RESULT RayTrace 283
PROGRESS Earley
PROGRESS Boyer
RESULT EarleyBoyer 325
PROGRESS RegExp
RESULT RegExp 60.5
PROGRESS Splay
RESULT Splay 470
PROGRESS NavierStokes
RESULT NavierStokes 277
SCORE 183
undefined

@jedel1043
Copy link
Member

Nice! I think Splay uses a lot of tree structures, so speeding up pointer accesses is very beneficial for that benchmark.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@jedel1043 jedel1043 added this pull request to the merge queue Jul 4, 2025
Merged via the queue into boa-dev:main with commit e0ff9b7 Jul 4, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Performance Performance related changes and issues C-GC Issue related to garbage collection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants