hermes-profile-transformer icon indicating copy to clipboard operation
hermes-profile-transformer copied to clipboard

Support for production profiles

Open zacharyfmarion opened this issue 1 year ago • 4 comments

Adds support for properly symbolicating production profiles taken with hermes. In production mode, hermes produces a slightly different profile format, where instead of line + column information it has funcVirtAddr and offset. As far as I can tell you can easily map this back to line and column by doing:

{
  line: 1, // always 1 for production hermes builds for now according to metro
  column: funcVirtAddr + offset + 1,
}

References:

Profiles taken with react-native-release-profiler. An example profile + sourcemap can be found here.

Demo

Speedscope now has first class support for both the raw and transformed hermes profile formats, it was used for the comparisons:

Before:

Screenshot 2024-01-09 at 6 52 58 PM

After:

Screenshot 2024-01-09 at 6 53 37 PM

zacharyfmarion avatar Jan 10 '24 02:01 zacharyfmarion

@saphal1998 would you mind taking a look at this when you get a chance?

zacharyfmarion avatar Jan 10 '24 04:01 zacharyfmarion

Hey @zacharyfmarion I don't currently have the permission to publish this package, I think @grabbou might be a better person to coordinate this with, but these changes do seem great and thank you so much for raising this PR :)

saphal1998 avatar Jan 13 '24 06:01 saphal1998

Okay thanks! FYI there is also an ongoing thread here about this change: https://github.com/facebook/hermes/discussions/1226#discussioncomment-8074520

zacharyfmarion avatar Jan 13 '24 17:01 zacharyfmarion

@zacharyfmarion I've added that code to the react-native-release-profiler https://github.com/margelo/react-native-release-profiler/pull/1

Szymon20000 avatar Jan 17 '24 11:01 Szymon20000