Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster string checking #14

Merged
merged 1 commit into from
Mar 30, 2018

Conversation

benaadams
Copy link
Contributor

@benaadams benaadams commented Mar 30, 2018

all.js is slower; but stops the perf drop off for string-number.js and string.js while infinity.js, null.js and number.js remain the same.

Pre

# fixtures\all.js (1999 bytes)
  current x 132,852 ops/sec ±0.73% (91 runs sampled)
  isFinite x 78,473 ops/sec ±0.74% (87 runs sampled)
  parseFloat x 52,720 ops/sec ±0.73% (90 runs sampled)

  fastest is current

# fixtures\infinity.js (31 bytes)
  current x 9,379,571 ops/sec ±0.71% (90 runs sampled)
  isFinite x 8,673,045 ops/sec ±0.99% (88 runs sampled)
  parseFloat x 9,349,973 ops/sec ±0.87% (85 runs sampled)

  fastest is current,parseFloat

# fixtures\null.js (27 bytes)
  current x 9,881,334 ops/sec ±0.81% (85 runs sampled)
  isFinite x 9,174,926 ops/sec ±0.99% (84 runs sampled)
  parseFloat x 5,786,175 ops/sec ±1.05% (85 runs sampled)

  fastest is current

# fixtures\number.js (24 bytes)
  current x 9,648,380 ops/sec ±1.16% (86 runs sampled)
  isFinite x 9,754,646 ops/sec ±0.88% (84 runs sampled)
  parseFloat x 9,875,265 ops/sec ±1.18% (84 runs sampled)

  fastest is parseFloat

# fixtures\string-number.js (26 bytes)
  current x 6,573,899 ops/sec ±0.78% (86 runs sampled)
  isFinite x 9,039,481 ops/sec ±0.74% (87 runs sampled)
  parseFloat x 8,963,505 ops/sec ±1.22% (84 runs sampled)

  fastest is isFinite,parseFloat

# fixtures\string.js (28 bytes)
  current x 5,076,053 ops/sec ±0.52% (90 runs sampled)
  isFinite x 7,560,679 ops/sec ±1.12% (87 runs sampled)
  parseFloat x 5,281,447 ops/sec ±0.57% (91 runs sampled)

  fastest is isFinite

Post

# fixtures\all.js (1999 bytes)
  current x 86,061 ops/sec ±0.80% (84 runs sampled)
  isFinite x 79,889 ops/sec ±0.82% (88 runs sampled)
  parseFloat x 48,906 ops/sec ±1.23% (87 runs sampled)

  fastest is current

# fixtures\infinity.js (31 bytes)
  current x 9,423,049 ops/sec ±0.74% (87 runs sampled)
  isFinite x 8,208,189 ops/sec ±0.86% (85 runs sampled)
  parseFloat x 9,221,105 ops/sec ±0.75% (89 runs sampled)

  fastest is current

# fixtures\null.js (27 bytes)
  current x 9,473,699 ops/sec ±1.32% (89 runs sampled)
  isFinite x 9,154,602 ops/sec ±1.04% (84 runs sampled)
  parseFloat x 5,601,123 ops/sec ±0.69% (87 runs sampled)

  fastest is current

# fixtures\number.js (24 bytes)
  current x 9,553,038 ops/sec ±1.01% (89 runs sampled)
  isFinite x 9,833,637 ops/sec ±0.75% (86 runs sampled)
  parseFloat x 9,633,350 ops/sec ±1.11% (87 runs sampled)

  fastest is isFinite

# fixtures\string-number.js (26 bytes)
  current x 9,509,395 ops/sec ±1.10% (85 runs sampled)
  isFinite x 9,009,025 ops/sec ±1.00% (84 runs sampled)
  parseFloat x 9,464,318 ops/sec ±1.34% (86 runs sampled)

  fastest is current,parseFloat

# fixtures\string.js (28 bytes)
  current x 7,750,388 ops/sec ±1.19% (85 runs sampled)
  isFinite x 7,217,064 ops/sec ±1.12% (87 runs sampled)
  parseFloat x 5,109,932 ops/sec ±0.76% (86 runs sampled)

  fastest is current

@jonschlinkert
Copy link
Owner

Awesome thank you!

@jonschlinkert jonschlinkert merged commit 9c50a4d into jonschlinkert:master Mar 30, 2018
@benaadams benaadams deleted the faster-string-number branch March 30, 2018 10:02
@jonschlinkert
Copy link
Owner

published and released as 6.0. thanks again!

@benaadams
Copy link
Contributor Author

Glad to help 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants