servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 122 forks source link

Use dynamic dispatch in `mozjs::panic::wrap_panic` #512

Closed SimonSapin closed 4 years ago

SimonSapin commented 4 years ago

Servo has generated code that calls it with thousands of different closures. With monomorphization, this function alone contributed significantly to code size (millions of lines of unoptimized LLVM IR) and compilation time: https://github.com/servo/servo/issues/26585

By switching to dynamic dispatch, compilation time for Servo’s script crate (which is pathologically long) is reduced by about a quarter on my machine.

Other changes are:

Dynamic dispatch has non-zero runtime cost. Perhaps here it is small enough, or compensated by better instruction cache utilization thanks to reduced code size?

jdm commented 4 years ago

@bors-servo r+

bors-servo commented 4 years ago

:pushpin: Commit dbb9bee has been approved by jdm

bors-servo commented 4 years ago

:hourglass: Testing commit dbb9bee06e0b0168ccae0619c5077e302669d2fb with merge c66102ec319158797b027e831d695e83b1921b17...

jdm commented 4 years ago

@bors-servo r- Sorry, jumped the gun.

jdm commented 4 years ago

@bors-servo r+

bors-servo commented 4 years ago

:pushpin: Commit dbb9bee has been approved by jdm

bors-servo commented 4 years ago

:hourglass: Testing commit dbb9bee06e0b0168ccae0619c5077e302669d2fb with merge 28248e1d6658e92dd5ecb0866e53a97f043b9b38...

bors-servo commented 4 years ago

:broken_heart: Test failed - checks-travis

jdm commented 4 years ago

I'm restarting the single job that timed out.

bors-servo commented 4 years ago

:sunny: Test successful - checks-travis, status-appveyor Approved by: jdm Pushing 28248e1d6658e92dd5ecb0866e53a97f043b9b38 to master...