Last active
February 6, 2022 12:26
-
-
Save sandeep-cs-dev/a2c7293c0d63d12359a03cc4bfe8af99 to your computer and use it in GitHub Desktop.
Revisions
-
sandeep-cs-dev revised this gist
Feb 6, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ setTimeout(() =>console.timeEnd('eventlooplag'), 100); /*blocking code, stalling event loop, delaying the execution of the setTimeout ie lag in the event loop */ const min = 2; const max = 3e6; const primes = []; function generatePrimes(start, range) { let isPrime = true; -
sandeep-cs-dev revised this gist
Feb 6, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ console.time('eventlooplag'); //event-loop timer phase setTimeout(() =>console.timeEnd('eventlooplag'), 100); /*blocking code, stalling event loop, delaying the execution of the setTimeout ie lag in the event loop */ const min = 2; -
sandeep-cs-dev revised this gist
Feb 6, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ console.time('eventlooplag'); //event-loop timer phase setTimeout(() =>console.timeEnd('eventlooplag'), 0); /*blocking code, stalling event loop, delaying the execution of the setTimeout ie lag in the event loop */ const min = 2; -
sandeep-cs-dev created this gist
Feb 6, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ console.time('eventlooplag'); //event-loop timer phase setTimeout(() =>console.timeEnd('eventlooplag'), 100); /*blocking code, stalling event loop, delaying the execution of the setTimeout ie lag in the event loop */ const min = 2; const max = 2e6; const primes = []; function generatePrimes(start, range) { let isPrime = true; let end = start + range; for (let i = start; i < end; i++) { for (let j = min; j < Math.sqrt(end); j++) { if (i !== j && i%j === 0) { isPrime = false; break; } } if (isPrime) { primes.push(i); } isPrime = true; } } generatePrimes(min, max);