The result of profile is confusing.
Reported by
slaye...@gmail.com,
Jul 27 2016
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 Steps to reproduce the problem: 1. Function A calls function B (A -> B), and the profile shows function B takes a long time (e.g 50s). 2. Because I want to know which part of the function B takes the most time, I split the large function into small parts: B, C, D. (A -> B -> C -> D) 3. Profile shows the small functions together take a very very short time, but their parent takes a long time. (B + C + D: 0s, A: 50s) What is the expected behavior? When a large function is split into small functions, the small functions should take no shorter time than the origin function in profile. What went wrong? Profile shows the small functions together take a very very short time, but their parent takes a long time. (B + C + D: 0s, A: 50s) Did this work before? N/A Chrome version: 52.0.2743.82 Channel: stable OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version: Shockwave Flash 22.0 r0 Any recommend to find out which part of a function is most time-consuming?
,
Jul 27 2016
,
Jul 30 2016
My guess is that it could be caused by inlining. Once you made findSegsNearArea small enough V8 inlined it into its caller. Currently profiler cannot tell if the long running code was originated from inlined function. I'm wondering why you need to split the function. Doesn't line level profile work for you? If you open the source code for the function it should annotate lines with the execution time.
,
Aug 2 2016
Thank you for your reply. I think your guess makes sense, I'll try to let V8 not inline the functions . I want to split the function findSegsNearArea because it's long and has several loop statements. I want to know how much time each part costs/ which loop statement is the most time-consuming to optimizing it. Thank you very much.
,
Aug 2 2016
The line level profile is exactly the tool that helps you track down where the time spent in a long function. Have you tried it?
,
Aug 22 2016
I'm closing it for now as it seems to work as intended. |
||||
►
Sign in to add a comment |
||||
Comment 1 by slaye...@gmail.com
, Jul 27 2016