esamattis / esamattis/underscore.string

Optimize _.pad

Open
#202 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
367
PR merge metrics
No merged PRs in 30d

Description

I've made a test perf for _.pad for the case of zero padding with numbers.

http://jsperf.com/ways-to-0-pad-a-number/15

As you can see, Underscore.string is usually half as slow than the medium.

I think we can optimize this a bit more by using Math for the case of numbers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.