moment/moment — pull request #1384 by petkaantonov (2013-12-30 12:05:30+00:00)
Title: improve performance of leftZeroFill

This patch improves performance of `leftZeroFill` by avoiding lots of unnecessary string concatenations. http://jsperf.com/zero-filling-full

Improvements in Node.JS:

- 10% faster when no zero filling is needed
- Same speed when 1 zero fill is needed
- 3x faster when 5 zero fills are needed
- ~2x faster when 2 zero fills are needed

I also changed the comment because the jsperf linked was incorrect - it doesn't use the code from the library and doesn't even use a zero fill argument. It also uses randomization which gives random results - the run to get least needed zero filling would win regardless of the actual performance of the implementation.