Skip to content

Instantly share code, notes, and snippets.

@atrodo
Created May 11, 2011 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atrodo/965709 to your computer and use it in GitHub Desktop.
Save atrodo/965709 to your computer and use it in GitHub Desktop.
benchmarks
--------------------------------------------------------------------------------
Profile data file 'callgrind.out.20378' (creator: callgrind-3.6.0.SVN-Debian)
--------------------------------------------------------------------------------
I1 cache:
D1 cache:
L2 cache:
Timerange: Basic block 0 - 56133700
Trigger: Program termination
Profiled target: ./winxed benchmarks.winxed (PID 20378, part 1)
Events recorded: Ir
Events shown: Ir
Event sort order: Ir
Thresholds: 99
Include dirs:
User annotated:
Auto-annotation: off
--------------------------------------------------------------------------------
Ir
--------------------------------------------------------------------------------
273,797,919 PROGRAM TOTALS
--------------------------------------------------------------------------------
Ir file:function
--------------------------------------------------------------------------------
273,797,919 ???:0x00000850 [/lib/ld-2.11.1.so]
273,053,096 ???:0x08048d30 [/home/atrodo/parrot/valgrind/winxed-read-only/winxed]
273,050,967 /build/buildd/eglibc-2.11.1/csu/libc-start.c:(below main) [/lib/tls/i686/cmov/libc-2.11.1.so]
273,050,724 ???:main [/home/atrodo/parrot/valgrind/winxed-read-only/winxed]
264,831,491 /home/atrodo/parrot/valgrind/parrot/src/call/pcc.c:Parrot_pcc_invoke_from_sig_object [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
264,827,629 /home/atrodo/parrot/valgrind/parrot/src/embed/bytecode.c:Parrot_api_run_bytecode [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
264,826,714 /home/atrodo/parrot/valgrind/parrot/src/packfile/api.c:Parrot_pf_execute_bytecode_program [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
264,784,434 /home/atrodo/parrot/valgrind/parrot/src/call/ops.c:runops [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
264,782,934 /home/atrodo/parrot/valgrind/parrot/src/runcore/main.c:runops_int [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
264,782,738 /home/atrodo/parrot/valgrind/parrot/src/runcore/cores.c:runops_fast_core [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
261,106,146 /home/atrodo/parrot/valgrind/parrot/src/call/pcc.c:Parrot_pcc_invoke_sub_from_c_args [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
58,747,167 /home/atrodo/parrot/valgrind/parrot/src/ops/core_ops.c:Parrot_callmethodcc_p_sc [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
52,294,240 /home/atrodo/parrot/valgrind/parrot/src/pmc.c:Parrot_pmc_new [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
51,899,718 /home/atrodo/parrot/valgrind/parrot/src/pmc.c:get_new_pmc_header [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
44,563,477 /home/atrodo/parrot/valgrind/parrot/src/packfile/api.c:Parrot_load_bytecode [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
41,756,095 /home/atrodo/parrot/valgrind/parrot/src/packfile/api.c:load_file [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
40,970,035 /home/atrodo/parrot/valgrind/parrot/src/ops/core_ops.c:Parrot_load_bytecode_s [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
40,066,606 /home/atrodo/parrot/valgrind/parrot/src/call/args.c:Parrot_pcc_build_sig_object_from_op [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
37,787,290 /home/atrodo/parrot/valgrind/parrot/src/pmc/sub.c:Parrot_Sub_invoke [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
36,760,767 /home/atrodo/parrot/valgrind/parrot/src/ops/core_ops.c:Parrot_set_args_pc [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
29,836,839 /home/atrodo/parrot/valgrind/parrot/src/call/pcc.c:Parrot_pcc_invoke_from_sig_object'2 [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
26,940,384 /home/atrodo/parrot/valgrind/parrot/src/extend.c:Parrot_ext_call [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
26,909,328 /home/atrodo/parrot/valgrind/parrot/src/call/args.c:fill_params [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
26,629,951 /home/atrodo/parrot/valgrind/parrot/src/pmc/nativepccmethod.c:Parrot_NativePCCMethod_invoke [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
25,566,172 /home/atrodo/parrot/valgrind/parrot/src/call/args.c:Parrot_pcc_fill_params_from_op [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
24,757,320 /home/atrodo/parrot/valgrind/parrot/src/gc/api.c:Parrot_gc_new_pmc_header [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
23,535,052 /home/atrodo/parrot/valgrind/parrot/src/packfile/api.c:PackFile_unpack [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
23,528,433 /home/atrodo/parrot/valgrind/parrot/src/packfile/api.c:PackFile_Segment_unpack [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
23,526,783 /home/atrodo/parrot/valgrind/parrot/src/packfile/api.c:directory_unpack [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
23,499,397 /home/atrodo/parrot/valgrind/parrot/src/packfile/api.c:PackFile_Segment_unpack'2 [/home/atrodo/parrot/valgrind/install/lib/libparrot.so.3.3.0]
class MyTestClass {
function get_integer[vtable]() { return 1; }
function get_int() { return 1; }
}
function get_int() { return 1; }
function main[main]() {
var total_runs = 1000000;
var obj = new MyTestClass;
var myint = new 'Integer';
float baseline = count_time("no dispatch (base line)", function() {
int count = total_runs;
int result = 0;
for (int i = 0; i < count; i++)
result = result + 1;
say(result);
});
/*
count_time("vtable calls", function() {
int count = total_runs;
myint = 1;
int result = 0;
for (int i = 0; i < count; i++)
result = result + myint;
say(result);
}, baseline);
count_time("function calls", function() {
int count = total_runs;
int result = 0;
for (int i = 0; i < count; i++)
result = result + get_int();
say(result);
}, baseline);
count_time("method calls with static dispatch", function() {
int count = total_runs;
int result = 0;
var meth = find_method(obj, "get_int");
for (int i = 0; i < count; i++)
result = result + obj.*meth();
say(result);
}, baseline);
*/
count_time("method calls with dynamic dispatch", function() {
int count = total_runs;
int result = 0;
for (int i = 0; i < count; i++)
result = result + obj.get_int();
say(result);
}, baseline);
/*
count_time("vtable_override calls", function() {
int count = total_runs;
int result = 0;
for (int i = 0; i < count; i++)
result = result + obj;
say(result);
}, baseline);
*/
}
function count_time(string description, var code, float basetime [optional], int has_base [opt_flag])
{
say(sprintf("Starting %s", [description]));
float starttime = floattime();
code();
float endtime = floattime();
float total_time = endtime - starttime;
say(sprintf("Total time: %fs", [total_time]));
if (has_base)
say(sprintf("%%Difference: %fs\n", [(total_time / basetime) * 100]));
return endtime - starttime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment