What do the “Not optimized” warnings in the Chrome Profiler mean?

前端 未结 5 1521
失恋的感觉
失恋的感觉 2021-01-30 16:20

When I use the Developer Tools in Chrome to collect JavaScript CPU Profiles, I am getting two mysterious warnings on functions:

  • Not optimized: optimized too many t
5条回答
  •  终归单人心
    2021-01-30 16:37

    1. I believe that "Not optimized: optimized too many times" refers to when the chrome optimizer keeps reoptimizing a function.

      https://groups.google.com/forum/#!topic/v8-users/_oZ4fUSitRY

      If I recall correctly, there are several things that can cause this including parameters that change type, I'll try to dig up the link.

      This one is somewhat cryptic and fixes will depend on your code. I've had this pop up in my code many times and sometimes I just can't fix it.

    2. 'Not optimized: inlining bailed out' Seems answered in the link you posted.

    3. For the try/catch, a non-exhaustive but useful list of Chrome optimization quirks can be found on this github page:

      https://github.com/petkaantonov/bluebird/wiki/Optimization-killers

      This page mentions that try/catches are not currently optimized:

      • Generator functions
      • Functions that contain a for-of statement
      • Functions that contain a try-catch statement
      • Functions that contain a try-finally statement
      • Functions that contain a compound let assignment
      • Functions that contain a compound const assignment
      • Functions that contain object literals that contain proto, or get or set declarations.

提交回复
热议问题