You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.bench.md 2.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Benchmark tests for json-c
  2. General strategy:
  3. -------------------
  4. * Identify "after" commit hash
  5. * Use provided directory
  6. * Use provided commit hash
  7. * Local changes in current working directory
  8. * ${cur_branch}
  9. * Identify "before" commit hash, in order of preference
  10. * Use provided directory
  11. * Use provided commit hash
  12. * Use origin/${cur_branch}, if different from ${after_commit}
  13. * Use previous release
  14. * If not using existing dir, clone to src-${after_commit}
  15. * or, checkout appropriate commit in existing src-${after_commit}
  16. * Create build & install dirs for ${after_commit}
  17. * Build & install ${after_commit}
  18. * Compile benchmark programs against install-${after_commit}
  19. * If not using existing dir, clone to src-${before_commit}
  20. * or, checkout appropriate commit in existing src-${before_commit}
  21. * Create build & install dirs for ${before_commit}
  22. * Build & install ${before_commit}
  23. * Compile benchmark programs against install-${before_commit}
  24. * Run benchmark in each location
  25. * Compare results
  26. heaptrack memory profiler
  27. ---------------------------
  28. https://milianw.de/blog/heaptrack-a-heap-memory-profiler-for-linux.html
  29. ```
  30. yum install libdwarf-devel elfutils boost-devel libunwind-devel
  31. git clone git://anongit.kde.org/heaptrack
  32. cd heaptrack
  33. mkdir build
  34. cd build
  35. cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  36. -DCMAKE_INSTALL_PREFIX=$HOME/heaptrack-install ..
  37. make install
  38. ```
  39. Issues
  40. --------
  41. * jc-bench.sh is incomplete.
  42. * valgrind massif misreports "extra-heap" bytes?
  43. "json_parse -n canada.json" shows 38640 KB maxrss.
  44. Using valgrind --tool=massif, a large amount of memory is listed as
  45. wasted "extra-heap" bytes. (~5.6MB)
  46. ```
  47. valgrind --tool=massif --massif-out-file=massif.out ./json_parse -n ~/canada.json
  48. ms_print massif.out
  49. ```
  50. Using heaptrack, and analyzing the histogram, only shows ~2.6MB
  51. ```
  52. heaptrack ./json_parse -n canada.json
  53. heaptrack --analyze heaptrack*gz -H histogram.out
  54. awk ' { s=$1; count=$2; ru=(int((s+ 15) / 16)) * 16; wasted = ((ru-s)*count); print s, count, ru-s, wasted; total=total+wasted} END { print "Total: ", total }' histogram.out
  55. ```
  56. With the (unreleased) arraylist trimming changes, maxrss reported by
  57. getrusage() goes down, but massif claims *more* total usage, and a HUGE
  58. extra-heap amount (50% of total).