Skip to content

Instantly share code, notes, and snippets.

@yamafaktory
Created February 2, 2017 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamafaktory/f97f1a82fd9c7e8ecbdd95d5ad57ea4b to your computer and use it in GitHub Desktop.
Save yamafaktory/f97f1a82fd9c7e8ecbdd95d5ad57ea4b to your computer and use it in GitHub Desktop.
pattern-guard execution time test
const Guards = require('./')
const guards = new Guards()
const [
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z
] = Array.from({length: 26}, (v, i) => i)
console.time()
const test = guards.equal({
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z
})`
| a > b = 1
| b > c = 2
| c > d = 3
| d > e = 4
| e > f = 5
| f > g = 6
| g > h = 7
| h > i = 8
| i > j = 9
| j > k = 10
| k > l = 11
| l > m = 12
| m > n = 13
| n > o = 14
| o > p = 15
| p > q = 16
| q > r = 17
| r > s = 18
| s > t = 19
| t > u = 20
| u > v = 21
| v > w = 22
| w > x = 23
| x > y = 24
| y < z = 25
`
console.timeEnd()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment