Skip to content

Commit

Permalink
inline GluHalfEdge.dst manually before compilation
Browse files Browse the repository at this point in the history
Closure Compiler won't do this since it's not a 'simple' getter, and V8 doesn't consistently inline at run time. This change is performance neutral on complicated polygons, but saves up to ~5% on streams of very simple polygons due to elimination of function call overhead.
  • Loading branch information
brendankenny committed Dec 19, 2015
1 parent fa695c0 commit febbc25
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 28 deletions.
8 changes: 7 additions & 1 deletion gulpfile.js
Expand Up @@ -110,6 +110,12 @@ gulp.task('build-cat', () => {
gulp.task('build-min', () =>
gulp.src(LIBTESS_SRC.concat('./build/closure_exports.js'))
.pipe(newer('./libtess.min.js'))

// TODO(bckenny): The start of library-specific compiler optimizations.
// Generalize and pull into separate module.
// Inline GluHalfEdge.dst() since closure won't do it for us.
.pipe(replace('.dst()', '.sym.org'))

.pipe(closureCompiler({
js_output_file: 'libtess.min.js',
compilation_level: 'ADVANCED',
Expand All @@ -126,7 +132,7 @@ gulp.task('build-min', () =>
'visibility',
],
use_types_for_optimization: true,
// variable_renaming_report: 'varreport.txt'
// variable_renaming_report: 'varreport.txt',

// Since DOM isn't touched, don't use default externs, leaving only the
// core language keywords unobfuscated.
Expand Down

0 comments on commit febbc25

Please sign in to comment.