JavaScript optimization challenge

JavaScript

Hi, we’re hosting the JS optimization challenge right now, with cash prizes and all. Link to full rules.

The challenge: make JS strftime function very fast, and beat the performance of GNU libc’s strftime.

The slower code that can be used as a base for optimizations is here: github.com/mvasilkov/strftime You’re free to use that source as the base of your solution.

To make things interesting, we’re not providing the reference benchmark. The benchmark will run on V8 (Node.js) engine.

Send your solutions to challengejs@hola.org (as attachments, GitHub gists or whatever). Last date for submission is June 22, 2014. Winners will be announced on June 29.

Comments

1,128

Ropes — Fast Strings

Most of us work with strings one way or another. There’s no way to avoid them — when writing code, you’re doomed to concatinate strings every day, split them into parts and access certain characters by index. We are used to the fact that strings are fixed-length arrays of characters, which leads to certain limitations when working with them. For instance, we cannot quickly concatenate two strings. To do this, we will at first need to allocate the required amount of memory, and then copy there the data from the concatenated strings.