Performance improvements #254

Open
mjackson opened this Issue Sep 10, 2012 · 2 comments

Comments

Projects
None yet
3 participants
Collaborator

mjackson commented Sep 10, 2012

With the 0.7.0 release I focused primarily on API improvements and stability. We unified the high-level API and simplified some of the inner workings of the library, which is a huge win I think for new users and for encouraging contributions.

As part of this work we removed the use of eval to increase compatibility with JavaScript environments that prohibit its use, such as Android. However, this slowed down the code noticeably. I wasn't too concerned with the slow down for several reasons:

  • the increased platform coverage is more important IMO
  • the code is still acceptably fast
  • there are many opportunities for optimization still left in the code

Also, the benchmark I'm using in that jsPerf is a bit silly really. It doesn't test very many of the advanced features of mustache.js, so I can't be sure how accurate those numbers really are in real-world scenarios.

I'd like to focus on bringing performance for the 0.7.1 release back up to par with what we were doing in 0.5.2 (our fastest release to date). There are two major areas I think we can focus on:

  • better benchmarks
  • algorithm optimization

What do y'all think? I'm actively looking for contributions in these areas, so anyone with expertise here is more than welcome to chime in. Thanks!

/cc @janl @natevw @cweider

Contributor

cweider commented Sep 10, 2012

Anyways, ouch, that needs improvement, I’ve a few patches to improve things basically inlining and decomposing the tail recursion*. One thing worth toying with are some automated performance tests to make checking the three steps of lex, generation, and execution easy.

  • Delaying the slice needed by higher order sections was an easy gain too.
Collaborator

mjackson commented Dec 28, 2012

@cweider Thanks for the suggestions. I've inlined all the rendering functions and put off the slice needed by higher order sections until it's actually needed, which provided some nice gains (look at the master branch vs. 0.7.0). I'm not sure how to go about decomposing the tail recursion though. Can you give me any pointers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment