Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by facepalm

11 years ago

Interesting - well I thought if it is being used by thousands of libraries it might be worth optimizing.

I just tried in NodeJS, you could also just instantiate an Array of a given length and join it with spaces, like this.

var x = new Array(5);x[4] = "abc";x.join(" ");

No idea if it could be faster - but the test you linked to pushes spaces into the Array.

0 comments

facepalm

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities