This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32cf07e
commit c8d44e4
Showing
9 changed files
with
200 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "semistandard" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
bench: lint | ||
npm run benchmark > out.txt | ||
npm run benchmark > out.txt | ||
npm run benchmark > out.txt | ||
tail -n 23 out.txt > bench.txt | ||
rm out.txt | ||
node --prof prof-filter.js > /dev/null | ||
node --prof-process *.log > out.txt | ||
grep -A 5 "Summary" -R out.txt > tick-filter.txt | ||
rm *.log && rm out.txt | ||
node --prof prof-filter_by_hand.js > /dev/null | ||
node --prof-process *.log > out.txt | ||
grep -A 5 "Summary" -R out.txt > tick-filter_by_hand.txt | ||
rm *.log && rm out.txt && touch README.md && rm README.md | ||
echo '## Benchmark' >> README.md | ||
echo ' ' >> README.md | ||
echo '```' >> README.md | ||
cat bench.txt >> README.md | ||
echo '```' >> README.md | ||
echo ' ' >> README.md | ||
echo '## Profile summary' >> README.md | ||
echo ' ' >> README.md | ||
echo 'Tick-filter' >> README.md | ||
echo '```' >> README.md | ||
cat tick-filter.txt >> README.md | ||
echo '```' >> README.md | ||
echo ' ' >> README.md | ||
echo 'Tick-filter_by_hand' >> README.md | ||
echo '```' >> README.md | ||
cat tick-filter_by_hand.txt >> README.md | ||
echo '```' >> README.md | ||
echo ' ' >> README.md | ||
rm *.txt | ||
lint: node_modules | ||
npm run lint | ||
|
||
clean: | ||
rm -rf node_modules | ||
|
||
node_modules: init | ||
npm install | ||
|
||
init: . | ||
cp ../package.json . | ||
cp ../.eslintrc.json . | ||
|
||
.PHONY: init |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## Benchmark | ||
|
||
``` | ||
filterByHand | ||
Raw: | ||
> 18203.796203796202 | ||
> 18307.69230769231 | ||
> 18639.36063936064 | ||
> 18612.38761238761 | ||
Average (mean) 18440.80919080919 | ||
filterr | ||
Raw: | ||
> 2040.959040959041 | ||
> 2050.949050949051 | ||
> 2050.949050949051 | ||
> 2046.9530469530469 | ||
Average (mean) 2047.4525474525476 | ||
Winner: filterByHand | ||
Compared with next highest (filterr), it's: | ||
88.9% faster | ||
9.01 times as fast | ||
0.95 order(s) of magnitude faster | ||
QUITE A BIT FASTER | ||
``` | ||
|
||
## Profile summary | ||
|
||
Tick-filter | ||
``` | ||
[Summary]: | ||
ticks total nonlib name | ||
3123 32.9% 33.2% JavaScript | ||
5638 59.4% 59.9% C++ | ||
330 3.5% 3.5% GC | ||
85 0.9% Shared libraries | ||
``` | ||
|
||
Tick-filter_by_hand | ||
``` | ||
[Summary]: | ||
ticks total nonlib name | ||
7675 82.0% 87.3% JavaScript | ||
516 5.5% 5.9% C++ | ||
232 2.5% 2.6% GC | ||
564 6.0% Shared libraries | ||
``` | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const games = [ | ||
{ name: 'Doom', year: 1993 }, | ||
{ name: 'Golden Axe', year: 1989 }, | ||
{ name: 'Gauntlet', year: 1985 }, | ||
{ name: 'Frostbite', year: 1983 }, | ||
{ name: 'Tiger Heli', year: 1985 } | ||
]; | ||
|
||
function filterByHand () { | ||
let oldGames = []; | ||
for (let i = 0; i < games.length; i++) { | ||
if (games[i].year <= 1985) { | ||
oldGames.push(games[i]); | ||
} | ||
} | ||
} | ||
|
||
exports.compare = { | ||
'filterr': function () { | ||
let weAreOld = games.filter(g => g.year <= 1985); // eslint-disable-line | ||
}, | ||
'filterByHand': function () { | ||
filterByHand(); | ||
} | ||
}; | ||
|
||
require('bench').runMain(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "perf-quest", | ||
"version": "0.0.1", | ||
"description": "Comparison between js features.", | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"benchmark": "node benchmark.js" | ||
}, | ||
"devDependencies": { | ||
"bench": "^0.3.6", | ||
"eslint": "^3.3.1", | ||
"eslint-config-semistandard": "^7.0.0-beta.0", | ||
"eslint-config-standard": "^6.0.0", | ||
"eslint-plugin-promise": "^2.0.1", | ||
"eslint-plugin-react": "^6.1.2", | ||
"eslint-plugin-standard": "^2.0.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
const games = [ | ||
{ name: 'Doom', year: 1993 }, | ||
{ name: 'Golden Axe', year: 1989 }, | ||
{ name: 'Gauntlet', year: 1985 }, | ||
{ name: 'Frostbite', year: 1983 }, | ||
{ name: 'Tiger Heli', year: 1985 } | ||
]; | ||
|
||
exports.compare = { | ||
'filterr1': function () { | ||
let weAreOld = games.filter(g => g.year <= 1985); // eslint-disable-line | ||
}, | ||
'filterr2': function () { | ||
let weAreOld = games.filter(g => g.year <= 1985); // eslint-disable-line | ||
} | ||
}; | ||
|
||
require('bench').runMain(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const games = [ | ||
{ name: 'Doom', year: 1993 }, | ||
{ name: 'Golden Axe', year: 1989 }, | ||
{ name: 'Gauntlet', year: 1985 }, | ||
{ name: 'Frostbite', year: 1983 }, | ||
{ name: 'Tiger Heli', year: 1985 } | ||
]; | ||
|
||
function filterByHand () { | ||
let oldGames = []; | ||
for (let i = 0; i < games.length; i++) { | ||
if (games[i].year <= 1985) { | ||
oldGames.push(games[i]); | ||
} | ||
} | ||
} | ||
|
||
exports.compare = { | ||
'filterByHand1': function () { | ||
filterByHand(); | ||
}, | ||
'filterByHand2': function () { | ||
filterByHand(); | ||
} | ||
}; | ||
|
||
require('bench').runMain(); |