-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7264: Improve the performance of the JFR parser #266
Conversation
When parsing a JFR file, StackFrames are the objects that are the most deserialized using Readers. By default, JMC core parser used a generic ReflectiveReaders which use reflection to parser the structure. However, we have known objects like stack frames where we could directly map to the typed object instead on relying on reflection, which speed up significantly the parsing.
👋 Welcome back jpbempel! A progress list of the required criteria for merging this PR into |
Webrevs
|
I never thought reflection was a good idea, and It makes sense to have specialised logic for known types, but I don't think the code should rely on the field order. In earlier release of JMC (4.1), there was similar specialiced logic as yours, but it broke once the "truncated" field was added to the stack trace struct in JDK 7. The same thing can happen again. Back then, there was a field accessor class where the index was looked up when the parser was created. When the value was read the accessor could use the pre-calculated index to get the correct value. It might even have been bytecode generated for optimal performance. |
Agreed that this code is fragile. |
if unexpected field, fallbacks to reflective way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, even though the code will not handle removal of a field, but it's perhaps not as likely, and may fail anyway in the UI layer.
@jpbempel This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 1 new commit pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
When parsing a JFR file, StackFrames are the objects that are the most
deserialized using Readers.
By default, JMC core parser used a generic ReflectiveReaders
which use reflection to parser the structure. However, we have known
objects like stack frames where we could directly map to the typed
object instead on relying on reflection, which speed up significantly
the parsing.
Here the results for c5.2xlarge instance single threaded parsing with 24MB jfr recording with 100 iterations:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jmc pull/266/head:pull/266
$ git checkout pull/266
Update a local copy of the PR:
$ git checkout pull/266
$ git pull https://git.openjdk.java.net/jmc pull/266/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 266
View PR using the GUI difftool:
$ git pr show -t 266
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jmc/pull/266.diff