Permalink
Browse files

[Gary] profiling for both C and Ruby

  • Loading branch information...
1 parent 52cbaa6 commit ba0de1bc264cba19ce4378d19fe32bbbdf692452 @gjmurakami-10gen gjmurakami-10gen committed Apr 16, 2012
Showing with 429 additions and 200 deletions.
  1. +1 −0 Gemfile
  2. +45 −33 bench/exp_series.html
  3. +273 −136 bench/exp_series.js
  4. +80 −29 bench/exp_series.rb
  5. +30 −2 bench/profile_array.rb
View
@@ -16,6 +16,7 @@ group :development, :test do
gem "test-unit"
gem "ci_reporter"
gem "ruby-prof" unless RUBY_PLATFORM =~ /java/
+ gem "perftools.rb" unless RUBY_PLATFORM =~ /java/
# Java
platforms :jruby do
View
@@ -27,16 +27,22 @@
<div id="placeholder"></div>
<script type="text/javascript">
- function genOpXY(a, xMax, base, gen, op, xKey, yKey) {
- var genOpA = $.grep(a, function(e, i){return (e.exp2 <= xMax && e.base == base && e.generator == gen && e.operation == op);});
+ function genOpXY(a, xMax, plotSpec, xKey, yKey) {
+ var genOpA = $.grep(a, function(e, i){
+ if (e.exp2 > xMax) return false;
+ for (var key in plotSpec) {
+ if (e[key] != plotSpec[key]) return false;
+ }
+ return true;
+ });
return $.map(genOpA, function(e, i){return [[e[xKey], e[yKey]]];});
}
- function flotSeries(expSeries, xMax, a) {
- return $.map(a, function(e, i){
- var base = e[0]; gen = e[1]; var op = e[2];
+ function flotSeries(expSeries, xMax, plotSpecs) {
+ return $.map(plotSpecs, function(plotSpec, i){
+ var base = plotSpec.base; var gen = plotSpec.generator; var op = plotSpec.operation;
return {
label: gen + '-' + base,
- data: genOpXY(expSeries, xMax, base, gen, op, 'exp2', 'ops'),
+ data: genOpXY(expSeries, xMax, plotSpec, 'exp2', 'ops'),
lines: { show: true },
points: { show: true }
};
@@ -66,50 +72,56 @@
// comment pending
var graph = [
- [ 'value_string_size insert', 14, [
- [2, 'value_string_size', 'insert']
+ [ 'value_string_size insert C', 14,
+ [
+ { base:2, generator:'value_string_size', operation:'insert', mongo_driver_mode: 'c' }
]
],
- [ 'key_string_size insert', 14, [
- [2, 'key_string_size', 'insert']
+ [ 'key_string_size insert C', 14,
+ [
+ { base:2, generator:'key_string_size', operation:'insert', mongo_driver_mode: 'c' }
]
],
- [ 'array_size_fixnum insert', 12, [
- [2, 'array_size_fixnum', 'insert']
+ [ 'array_size_fixnum insert C', 12,
+ [
+ { base:2, generator:'array_size_fixnum', operation:'insert', mongo_driver_mode: 'c' }
]
],
- [ 'hash_size_fixnum insert', 12, [
- [2, 'hash_size_fixnum', 'insert']
+ [ 'hash_size_fixnum insert C', 12,
+ [
+ { base:2, generator:'hash_size_fixnum', operation:'insert', mongo_driver_mode: 'c' }
]
],
- [ 'array_nest_fixnum insert', 12, [
- [2, 'array_nest_fixnum', 'insert'],
- [4, 'array_nest_fixnum', 'insert'],
- [8, 'array_nest_fixnum', 'insert'],
- [16, 'array_nest_fixnum', 'insert'],
- [32, 'array_nest_fixnum', 'insert']
+ [ 'array_nest_fixnum insert C', 12,
+ [
+ { base:2, generator:'array_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:4, generator:'array_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:8, generator:'array_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:16, generator:'array_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:32, generator:'array_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' }
]
],
- [ 'hash_nest_fixnum insert', 12, [
- [2, 'hash_nest_fixnum', 'insert'],
- [4, 'hash_nest_fixnum', 'insert'],
- [8, 'hash_nest_fixnum', 'insert'],
- [16, 'hash_nest_fixnum', 'insert'],
- [32, 'hash_nest_fixnum', 'insert']
+ [ 'hash_nest_fixnum insert C', 12,
+ [
+ { base:2, generator:'hash_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:4, generator:'hash_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:8, generator:'hash_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:16, generator:'hash_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:32, generator:'hash_nest_fixnum', operation:'insert', mongo_driver_mode: 'c' }
]
],
- [ 'compare array_size_fixnum hash_size_fixnum insert', 12, [
- [2, 'array_size_fixnum', 'insert'],
- [2, 'hash_size_fixnum', 'insert']
+ [ 'compare array_size_fixnum hash_size_fixnum insert C', 12,
+ [
+ { base:2, generator:'array_size_fixnum', operation:'insert', mongo_driver_mode: 'c' },
+ { base:2, generator:'hash_size_fixnum', operation:'insert', mongo_driver_mode: 'c' }
]
- ],
-
+ ]
];
$.each(graph, function(i, e){
var title = e[0];
var xMax = e[1];
- var baseSeriesGenOp = e[2];
- var series = flotSeries(expSeries, xMax, baseSeriesGenOp);
+ var plotSpecs = e[2];
+ var series = flotSeries(expSeries, xMax, plotSpecs);
doPlot(title, series);
});
Oops, something went wrong.

0 comments on commit ba0de1b

Please sign in to comment.