Created
May 10, 2018 09:23
-
-
Save mmirolim/bbf109c44e4f388a00b3995fe7834cd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { performance } = require('perf_hooks'); | |
const fibo = fib() | |
function fib() { | |
let x = 0 | |
let y = 1 | |
return function () { | |
const temp = x; | |
x = x + y; | |
y = temp; | |
return y | |
} | |
} | |
var text = 'For more information, see Chapter 3.4.5.1' | |
var t0 = performance.now(); | |
for (let j=0; j<100; j++) { | |
for (let i=0; i<100; i++){ | |
str = new Date() | |
d = new Date(str) | |
found = text.match(/see (chapter \d+(\.\d)*)/i); | |
console.log(fibo(), str.toString(), found, d) | |
} | |
} | |
var t1 = performance.now(); | |
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds."); | |
// standart x1 770 ms | |
// laptop asus 620 ms | |
// c5.large 570 ms | |
// m5.large 620 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment