Skip to content

Commit

Permalink
add small benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Aug 13, 2011
1 parent f24f30f commit 2e36cba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#========================================================

import os, sys, re, json
import os, sys, re, json, shutil
from subprocess import Popen, PIPE, STDOUT

exec(open(os.path.expanduser('~/.emscripten'), 'r').read())
Expand Down
4 changes: 4 additions & 0 deletions examples/stress.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function main() {

var trans = new btTransform(); // taking this out of the loop below us reduces the leaking

var startTime = Date.now();

for (var i = 0; i < 450; i++) {
dynamicsWorld.stepSimulation(1/60, 10);

Expand All @@ -62,6 +64,8 @@ function main() {
}
});
}

print('total time: ' + ((Date.now()-startTime)/1000).toFixed(3));
}

main();
Expand Down
5 changes: 3 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,16 @@ def run(filename):
print '2. stress'

output = run(os.path.join('examples', 'stress.js'))
assert output.endswith('''
assert '''
0 : 0.00,-56.00,0.00
1 : -4.93,-5.00,2.64
2 : 3.45,-5.00,-0.27
3 : 7.20,-5.00,-1.43
4 : 12.08,-5.00,-3.28
5 : 22.82,-5.00,-6.41
6 : -7.40,-5.00,1.15
'''), output
total time:''' in output, output
print ' stress benchmark: ' + output.split('\n')[-2]

print
print 'ok.'
Expand Down

0 comments on commit 2e36cba

Please sign in to comment.