repeat-string
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -39,4 +39,6 @@ /*! | ||
if (num === 1) return str; | ||
if (num === 2) return str + str; | ||
var max = str.length * num; | ||
if (cache !== str || typeof cache === 'undefined') { | ||
@@ -53,2 +55,3 @@ cache = str; | ||
num >>= 1; | ||
if (!num) break; | ||
str += str; | ||
@@ -55,0 +58,0 @@ } |
{ | ||
"name": "repeat-string", | ||
"description": "Repeat the given string n times. Fastest implementation for repeating a string.", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"homepage": "https://github.com/jonschlinkert/repeat-string", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -35,3 +35,2 @@ # repeat-string [![NPM version](https://badge.fury.io/js/repeat-string.svg)](http://badge.fury.io/js/repeat-string) | ||
## Benchmarks | ||
@@ -43,20 +42,20 @@ | ||
# 20,000x | ||
repeat-string.js x 16,619,408 ops/sec ±1.05% (92 runs sampled) | ||
repeating.js x 5,991,724 ops/sec ±0.62% (98 runs sampled) | ||
repeat-string.js x 16,634,213 ops/sec ±0.92% (93 runs sampled) | ||
repeating.js x 5,883,928 ops/sec ±0.95% (93 runs sampled) | ||
# 2,000x | ||
repeat-string.js x 17,284,768 ops/sec ±0.71% (94 runs sampled) | ||
repeating.js x 6,828,993 ops/sec ±0.87% (96 runs sampled) | ||
repeat-string.js x 17,438,654 ops/sec ±0.76% (97 runs sampled) | ||
repeating.js x 6,639,978 ops/sec ±0.84% (97 runs sampled) | ||
# 250x | ||
repeat-string.js x 16,241,986 ops/sec ±0.78% (93 runs sampled) | ||
repeating.js x 7,281,492 ops/sec ±0.76% (95 runs sampled) | ||
repeat-string.js x 16,246,885 ops/sec ±0.81% (92 runs sampled) | ||
repeating.js x 7,659,342 ops/sec ±0.67% (99 runs sampled) | ||
# 50x | ||
repeat-string.js x 16,447,301 ops/sec ±1.12% (96 runs sampled) | ||
repeating.js x 8,933,633 ops/sec ±0.64% (98 runs sampled) | ||
repeat-string.js x 15,803,340 ops/sec ±0.74% (92 runs sampled) | ||
repeating.js x 9,668,300 ops/sec ±0.89% (98 runs sampled) | ||
# 5x | ||
repeat-string.js x 16,363,515 ops/sec ±1.09% (98 runs sampled) | ||
repeating.js x 12,164,964 ops/sec ±0.74% (98 runs sampled) | ||
repeat-string.js x 16,926,291 ops/sec ±0.78% (97 runs sampled) | ||
repeating.js x 12,215,384 ops/sec ±1.01% (96 runs sampled) | ||
``` | ||
@@ -114,2 +113,2 @@ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 24, 2015._ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 26, 2015._ |
5792
54
111