Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/speed regression #705

Merged
merged 8 commits into from
Oct 20, 2023
Merged

Conversation

tesonep
Copy link
Collaborator

@tesonep tesonep commented Oct 20, 2023

Just to give some more details (@guillep editing here):

This release fixes a regression introduced during a refactoring.
The refactoring introduced accidentally an eager compilation of methods to machine code and reduced the number of JIT'ted methods activated.
This provoked, on the one hand, spending extra time on compiling useless methods and trashing the machine code cache, and on the other hand, an over-reliance on the interpreter interpreter.

This PR re-introduces those heuristics while keeping the refactoring (that removed lots of duplicated code).

This week we worked also on moving forward the benchmarking infrastructure to be able to eagerly detect these kind of issues in the future. See the list of benchmarks below showing the performance of a couple of benchmarks for VMs version 10.0.4 (default in Pharo 10), 10.0.7 (default in Pharo 11) and 10.0.8 (10.0.7 + this fix).

Interestingly, the regression only affects two benchmarks but very markingly: see column 10.0.7.
Also, since 10.0.7 we have a slight improvement in reverse complement and file benchmarks, probably due to ephemerons and GC improvements.

  10.0.4 10.0.7 ms (compared to 10.0.4) 10.0.8 ms (compared to 10.0.4)
       
benchMeteor 142 323(0.44:arrow_down:) 143(0.99)
benchMandelbrot 732 732(1.00) 734(1.00)
benchSpectralNorm 732 743(0.99) 732(1.00)
benchPiDigits 93 92(1.01) 95(0.98)
benchChameneosRedux 59 61(0.97) 59(1.00)
benchKNucleotide 331 363(0.91:arrow_down:) 331(1.00)
benchRegexDNA 1280 1128(1.13:arrow_up:) 1313(0.97)
benchBinaryTrees 234 261(0.90:arrow_down:) 235(1.00)
benchReverseComplement 100 91(1.10:arrow_up:) 90(1.11:arrow_up:)
benchChameleons 82 88(0.93:arrow_down:) 85(0.96)
benchThreadRing 23 24(0.96) 24(0.96)
benchNBody 410 419(0.98) 404(1.01)
benchFasta 166 169(0.98) 169(0.98)
SMarkDeltaBlue 95 91(1.04) 101(0.94:arrow_down:)
SMarkRichards 68 67(1.01) 68(1.00)
File.* 8549 7957(1.07:arrow_up:) 7872(1.09:arrow_up:)
Kernel.* 10420 10372(1.00) 10228(1.02)
Opal.* 909 1275(0.71:arrow_down:) 895(1.02)

Copy link
Member

@guillep guillep left a comment

Choose a reason for hiding this comment

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

Good!

cogit cog: newMethod selector: objectMemory nilObject.
methodHeader := self rawHeaderOf: newMethod ]
ifFalse: [ self maybeFlagMethodAsInterpreted: newMethod ] ].

Copy link
Member

Choose a reason for hiding this comment

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

Good, do not compile on method activation

instructionPointer := cogit ceReturnToInterpreterPC].
^ self activateCoggedNewMethod: inInterpreter].

"We are in the interpreter"
Copy link
Member

Choose a reason for hiding this comment

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

yes, activate compiled method if already compiled

"if not primitive, or primitive failed, activate the method"
self activateNewMethod ]
]

Copy link
Member

Choose a reason for hiding this comment

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

This is the major change in here, now this method can be parametrised to eagerly compile methods (or not). By default the interpreter will not do it.

@guillep guillep merged commit dce9f98 into pharo-project:pharo-10 Oct 20, 2023
1 of 2 checks passed
@guillep guillep deleted the fix/speedRegression branch October 20, 2023 19:58
@guillep guillep mentioned this pull request Oct 20, 2023
@jordanmontt
Copy link
Member

Thanks for the explanation @guillep

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