JDK-8059321 : Significant parser/frontend overhead in recompilation of avatar.js
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u40
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-09-29
  • Updated: 2015-06-04
  • Resolved: 2014-09-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b34Fixed
Description
Optimistic types introduced significant startup overhead for avatar in 8u40

I managed to cut down Michel's startup benchmark for avatar with optimistic typing quite a bit by doing some simple changes, e.g. have the regexp engine remember correctly compiled regular expressions and remove boxing that happened even when logging was disabled. 
Comments
With fix: [time] Accumulated compilation phase timings: [time] [time] 'JavaScript Parsing' 608 ms [time] 'Constant Folding' 72 ms [time] 'Control Flow Lowering' 125 ms [time] 'Program Point Calculation' 99 ms [time] 'Builtin Replacement' 103 ms [time] 'Code Splitting' 312 ms [time] 'Symbol Assignment' 346 ms [time] 'Scope Depth Computation' 97 ms [time] 'Optimistic Type Assignment' 132 ms [time] 'Local Variable Type Calculation' 379 ms [time] 'Bytecode Generation' 2879 ms [time] 'Class Installation' 1320 ms [time] 'Reuse Compile Units' 64 ms [time] [time] Total runtime: 9557 ms (Non-runtime: 6542 ms [68%]) [time] [time] Emitted compile units: 1356 Without fix [time] Accumulated compilation phase timings: [time] [time] 'JavaScript Parsing' 2398 ms [time] 'Constant Folding' 77 ms [time] 'Control Flow Lowering' 149 ms [time] 'Program Point Calculation' 98 ms [time] 'Builtin Replacement' 102 ms [time] 'Code Splitting' 231 ms [time] 'Symbol Assignment' 357 ms [time] 'Scope Depth Computation' 94 ms [time] 'Optimistic Type Assignment' 135 ms [time] 'Local Variable Type Calculation' 366 ms [time] 'Bytecode Generation' 3375 ms [time] 'Class Installation' 1510 ms [time] 'Reuse Compile Units' 67 ms [time] [time] Total runtime: 11971 ms (Non-runtime: 8564 ms [74%]) [time] [time] Emitted compile units: 1356 Note that reparsing overhead turns insignificant. I have spotted several other low hanging fruits that I will try to address later. The fix is simple.
29-09-2014