Make a PreparedScriptBenchmark class closer to the original#2325
Conversation
|
But this is how the script preparation is intended to be used, you cache them in process as the preparation is allowed to be costly and take time, then you have optimized script that can be fed to the Engine multiple times. Ad-hoc running of scripts doesn't need preparation. Am I missing something here? |
430c227 to
ea21f56
Compare
|
Hello, Marko! When I wrote It seems that the long execution time of the I consider the result in second row to be very good. I'm planning to disable regular expression compilation in the JavaScriptEngineSwitcher.Jint module. |
|
@Taritsyn great findings! indeed, regex compile is time-consuming and not lightweight. Is there still something that you would like to see in Jint repo via this PR, just merge this as an example of scenarios? |
|
This PR is complete and can be merged. |
|
Thank you! |
Hello!
Main difference between the
PreparedScriptBenchmarkclass and the original one is that the script is pre-compiled in theSetupmethod and is therefore not taken into account when measuring performance.Initial version of the
PreparedScriptBenchmarkclass shows very good result:Version with my edits shows a result close to the original:
Perhaps this is due to the fact that every time the
Engine.PrepareScriptmethod is called, then a new instance of theParserclass is created.