Skip to content

Instantly share code, notes, and snippets.

@smarr
Last active May 3, 2022 15:10
Show Gist options
  • Save smarr/cf0ecfac8694df29d32805b55bfec3cd to your computer and use it in GitHub Desktop.
Save smarr/cf0ecfac8694df29d32805b55bfec3cd to your computer and use it in GitHub Desktop.
Quick and Dirty TruffleRuby Liquid Stats
jt --use jvm-ce ruby --experimental-options --engine.Compilation=false harness.rb LiquidRenderBibs  1 1
jt --use jvm-ce ruby --experimental-options --engine.Compilation=false harness.rb LiquidCartParse   1 1
jt --use jvm-ce ruby --experimental-options --engine.Compilation=false harness.rb LiquidCartRender  1 1
jt --use jvm-ce ruby --experimental-options --engine.Compilation=false harness.rb LiquidMiddleware  1 1

All Counts are Activation Counts

  • Trivial Calls: 662363
  • Non-Trivial Calls: 120476
  • Execute: 782815
  • Assign: 24

Number of Arguments to Calls

  • 0: 301330
  • 1: 349016
  • 2: 60445
  • 3: 45257
  • 4: 7124
  • 5: 703
  • 6: 11701
  • 7: 7255
  • 19: 4
  • 24: 4

Number of Statement Executions: 610412

  • 2: 85129
  • 3: 114438
  • 4: 153384
  • 5: 76575
  • 6: 78846
  • 7: 32657
  • 8: 23531
  • 9: 15432
  • 10: 21271
  • 11: 1354
  • 12: 4844
  • 13: 582
  • 14: 1397
  • 15: 513
  • 16: 89
  • 17: 36
  • 18: 8
  • 19: 12
  • 20: 12
  • 21: 34
  • 22: 20
  • 23: 20
  • 24: 7
  • 25: 4
  • 26: 16
  • 27: 12
  • 28: 8
  • 29: 4
  • 31: 4
  • 32: 3
  • 33: 12
  • 34: 11
  • 36: 16
  • 37: 8
  • 39: 8
  • 41: 7
  • 45: 4
  • 49: 8
  • 51: 4
  • 52: 8
  • 53: 8
  • 56: 4
  • 60: 4
  • 62: 4
  • 67: 4
  • 68: 4
  • 70: 4
  • 72: 4
  • 73: 4
  • 77: 4
  • 83: 4
  • 93: 8
  • 113: 4
  • 115: 4
  • 120: 4
  • 127: 4
  • 140: 4
  • 185: 4
  • 348: 4
require 'csv'
FILES = [
'call-stats-LiquidCartParse.csv',
'call-stats-LiquidCartRender.csv',
'call-stats-LiquidMiddleware.csv',
'call-stats-LiquidRenderBibs.csv'
]
results = {}
FILES.each do |f|
results[f] = CSV.read(f)
end
trivial = 0
non_trivial = 0
execute = 0
assign = 0
stmt_size = Hash.new(0)
stmt_cnt = 0
num_args = Hash.new(0)
results.each do |f,data|
data.each do |e|
next if e.empty?
if e[0] == '[STATS] SequenceNode'
stmt_cnt += 1
stmt_size[e[2].to_i] += 1
else
if e[0].include? 'Trivial'
trivial += 1
else
non_trivial += 1
end
if e[1] == 'execute'
execute += 1
else
assign += 1
end
num_args[e[3].to_i] += 1
end
end
end
puts "All Counts are Activation Counts\n\n"
puts "Trivial Calls: #{trivial}"
puts "Non-Trivial Calls: #{non_trivial}"
puts "Execute: #{execute}"
puts "Assign: #{assign}"
puts 'Number of Arguments'
num_args.each do |n,cnt|
puts "\t#{n}: #{cnt}"
end
puts "Number of Statement Executions: #{stmt_cnt}"
stmt_size.each do |n,cnt|
puts "\t#{n}: #{cnt}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment