diff options
author | alon@honor <none@none> | 2010-10-12 20:38:12 -0700 |
---|---|---|
committer | alon@honor <none@none> | 2010-10-12 20:38:12 -0700 |
commit | d276be7499faff9814dc3cad07c2685284645106 (patch) | |
tree | 72f22f38a93f6985aeb2835fe787fdb7e3ad4608 /tests | |
parent | c26bc164ae97370dfc32feb909649f37a9412164 (diff) |
use closure compiler in benchmarks; 13% speedup
Diffstat (limited to 'tests')
-rw-r--r-- | tests/runner.py | 13 | ||||
-rw-r--r-- | tests/settings.py | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py index 44b5f272..ad1f82e1 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -897,6 +897,8 @@ else: sys.argv = filter(lambda x: x != 'benchmark', sys.argv) + assert(os.path.exists(CLOSURE_COMPILER)) + COMPILER = LLVM_GCC JS_ENGINE = SPIDERMONKEY_ENGINE #JS_ENGINE = V8_ENGINE @@ -926,12 +928,21 @@ else: filename = os.path.join(dirname, 'src.cpp') self.build(src, dirname, filename, main_file=main_file) + # Optimize using closure compiler + try: + os.remove(filename + '.cc.js') + except: + pass + cc_output = Popen(['java', '-jar', CLOSURE_COMPILER, '--compilation_level', 'ADVANCED_OPTIMIZATIONS', '--formatting', 'PRETTY_PRINT', + '--js', filename + '.o.js', '--js_output_file', filename + '.cc.js'], stdout=PIPE, stderr=STDOUT).communicate()[0] + assert('ERROR' not in cc_output) + # Run global total_times times = [] for i in range(TEST_REPS): start = time.time() - self.run_generated_code(JS_ENGINE, filename + '.o.js', args, check_timeout=False) + self.run_generated_code(JS_ENGINE, filename + '.cc.js', args, check_timeout=False) curr = time.time()-start times.append(curr) total_times[i] += curr diff --git a/tests/settings.py b/tests/settings.py index 9452fa81..87601391 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -35,3 +35,5 @@ COMPILER_ENGINE=V8_ENGINE OUTPUT_TO_SCREEN = 0 # useful for debugging specific tests, or for subjectively seeing what parts are slow +CLOSURE_COMPILER = os.path.expanduser('~/Dev/closure-compiler/compiler.jar') + |