Skip to content
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

Improve performance by skipping bytes instead of parsing again on a second pass (or first) #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dkomanov
Copy link

For 2GB heap dump:

$ wc large.hprof 
   2545071   20258239 2438383468 large.hprof

Baseline performance (ParallelGC is much better):

$ time java -Xmx5G -XX:+UseParallelGC -cp $CLASSPATH edu.tufts.eaftan.hprofparser.Parse --handler=edu.tufts.eaftan.hprofparser.handler.NullRecordHandler large.hprof

real	0m34.781s
user	0m39.424s
sys	0m1.759s

$ time java -Xmx5G -XX:+UseG1GC -cp $CLASSPATH edu.tufts.eaftan.hprofparser.Parse --handler=edu.tufts.eaftan.hprofparser.handler.NullRecordHandler large.hprof

real	0m42.754s
user	0m57.383s
sys	0m3.121s

After optimizations:

$ time java -Xmx5G -XX:+UseParallelGC -cp $CLASSPATH edu.tufts.eaftan.hprofparser.Parse --handler=edu.tufts.eaftan.hprofparser.handler.NullRecordHandler large.hprof

real	0m24.539s
user	0m25.911s
sys	0m1.373s

Other possible optimizations:

  • Increase buffer size for BufferedInputStream. Tried it, at most 200 milliseconds gain (variability is bigger).
  • Change primArrayDump interface to use native primitive arrays instead of Value<?>[]. It gives significant gain: 16 seconds against 24 seconds.

@dkomanov
Copy link
Author

This is how primArrayDump optimization would look like: dkomanov@81891b2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant