As far as I know, scripts are loaded and executed synchronously in javascript. Therefore, if we write the following code:
<script type='text/javascript'>console.time('core')</script> <script type='text/javascript' src="guicore.js"></script> <script type='text/javascript'>console.timeEnd('core')</script>
we will see in the console the total time for loading, parsing and executing js. How can we eliminate parsing time? Just add a similar file, but with all the comments. More or less, this method should work.
The problem is that it just doesn't work =)
I optimized this code, reduced the runtime from 90 ms to 25 ms, but I look the same ~ 100 ± 10 ms for Chrome and ~ 160 ± 15 ms for Firefox.
Well, I know that I can use the profiler, but the question is : "how to measure js parsing time correctly" and what I measured by the way. Research.reverse-engineering is a lot of fun, but maybe there is someone who knows this field in depth.
source share