Merge branch 'fix_compile_warnings'
This commit is contained in:
@@ -10,7 +10,7 @@ var os = use('internal/os')
|
||||
var fd = use('fd')
|
||||
|
||||
if (length(args) < 1) {
|
||||
print('usage: cell --dev bench_native.ce <module.cm> [iterations]')
|
||||
log.bench('usage: cell --dev bench_native.ce <module.cm> [iterations]')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -117,12 +117,12 @@ var run_bench = function(fn, label) {
|
||||
|
||||
// --- Load VM module ---
|
||||
|
||||
print('loading VM module: ' + file)
|
||||
log.bench('loading VM module: ' + file)
|
||||
var vm_mod = use(name)
|
||||
var vm_benches = collect_benches(vm_mod)
|
||||
|
||||
if (length(vm_benches) == 0) {
|
||||
print('no benchmarkable functions found in ' + file)
|
||||
log.bench('no benchmarkable functions found in ' + file)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -134,20 +134,20 @@ var has_native = fd.is_file(dylib_path)
|
||||
var lib = null
|
||||
|
||||
if (has_native) {
|
||||
print('loading native module: ' + dylib_path)
|
||||
log.bench('loading native module: ' + dylib_path)
|
||||
lib = os.dylib_open(dylib_path)
|
||||
native_mod = os.dylib_symbol(lib, symbol)
|
||||
native_benches = collect_benches(native_mod)
|
||||
} else {
|
||||
print('no ' + dylib_path + ' found -- VM-only benchmarking')
|
||||
print(' hint: cell --dev compile.ce ' + file)
|
||||
log.bench('no ' + dylib_path + ' found -- VM-only benchmarking')
|
||||
log.bench(' hint: cell --dev compile.ce ' + file)
|
||||
}
|
||||
|
||||
// --- Run benchmarks ---
|
||||
|
||||
print('')
|
||||
print('samples: ' + text(iterations) + ' (warmup: ' + text(WARMUP) + ')')
|
||||
print('')
|
||||
log.bench('')
|
||||
log.bench('samples: ' + text(iterations) + ' (warmup: ' + text(WARMUP) + ')')
|
||||
log.bench('')
|
||||
|
||||
var pad = function(s, n) {
|
||||
var result = s
|
||||
@@ -166,7 +166,7 @@ while (i < length(vm_benches)) {
|
||||
b = vm_benches[i]
|
||||
vm_result = run_bench(b.fn, 'vm')
|
||||
|
||||
print(pad(b.name, 20) + ' VM: ' + pad(format_ns(vm_result.median), 12) + ' (median) ' + format_ns(vm_result.mean) + ' (mean)')
|
||||
log.bench(pad(b.name, 20) + ' VM: ' + pad(format_ns(vm_result.median), 12) + ' (median) ' + format_ns(vm_result.mean) + ' (mean)')
|
||||
|
||||
// find matching native bench
|
||||
j = 0
|
||||
@@ -174,11 +174,11 @@ while (i < length(vm_benches)) {
|
||||
while (j < length(native_benches)) {
|
||||
if (native_benches[j].name == b.name) {
|
||||
nat_result = run_bench(native_benches[j].fn, 'native')
|
||||
print(pad('', 20) + ' NT: ' + pad(format_ns(nat_result.median), 12) + ' (median) ' + format_ns(nat_result.mean) + ' (mean)')
|
||||
log.bench(pad('', 20) + ' NT: ' + pad(format_ns(nat_result.median), 12) + ' (median) ' + format_ns(nat_result.mean) + ' (mean)')
|
||||
|
||||
if (nat_result.median > 0) {
|
||||
speedup = vm_result.median / nat_result.median
|
||||
print(pad('', 20) + ' speedup: ' + text(round(speedup * 100) / 100) + 'x')
|
||||
log.bench(pad('', 20) + ' speedup: ' + text(round(speedup * 100) / 100) + 'x')
|
||||
}
|
||||
found = true
|
||||
}
|
||||
@@ -186,9 +186,9 @@ while (i < length(vm_benches)) {
|
||||
}
|
||||
|
||||
if (has_native && !found) {
|
||||
print(pad('', 20) + ' NT: (no matching function)')
|
||||
log.bench(pad('', 20) + ' NT: (no matching function)')
|
||||
}
|
||||
|
||||
print('')
|
||||
log.bench('')
|
||||
i = i + 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user