-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add matching node.js test of harden/branding-mode performance
and results from my linux box
- Loading branch information
Showing
8 changed files
with
2,601 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
turing-node-data.json was captured on my local linux box named 'turing', | ||
whose /proc/cpuinfo says: | ||
|
||
model name : Intel(R) Xeon(R) CPU E3-1230L v3 @ 1.80GHz | ||
|
||
by running './drive-node-perf.sh > data.json' and then lightly editing | ||
data.json to add [] and remove a trailing comma. | ||
|
||
-Brian Warner, 18-may-2021 |
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,10 @@ | ||
#!/bin/bash | ||
|
||
for name in nothing list hardList listHard; do | ||
for branding in BOTH POSITIVE NEGATIVE; do | ||
# 'listHard' is the most time consuming, 10000 takes 90s | ||
for count in 10 100 1000 10000; do | ||
node -r esm ./t-node-perf.js $branding $name $count |grep -v "Removing" | ||
done | ||
done | ||
done |
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,49 @@ | ||
import { branding, name, count } from './t-setup.js'; | ||
import { performance } from 'perf_hooks'; | ||
|
||
function f(count, body, post) { | ||
const before = performance.now(); | ||
let list = {}; | ||
for (let i = 0; i < count; i++) { | ||
if (body === '//nothing') { | ||
//nothing | ||
} else if (body === 'list = {next: list};') { | ||
list = {next: list}; | ||
} else if (body === 'list = harden({next: list});') { | ||
list = harden({next: list}); | ||
} else { | ||
throw Error(`unknown body '${body}'`); | ||
} | ||
} | ||
if (post === '//nothing') { | ||
// nothing | ||
} else if (post === 'harden(list);') { | ||
harden(list); | ||
} else { | ||
throw Error(`unknown post '${post}'`); | ||
} | ||
const after = performance.now(); | ||
return(after - before); | ||
} | ||
|
||
const [body, post] = { | ||
nothing: ['//nothing', '//nothing'], | ||
list: ['list = {next: list};', '//nothing'], | ||
listHard: ['list = harden({next: list});', '//nothing'], | ||
hardList: ['list = {next: list};', 'harden(list);'], | ||
}[name]; | ||
|
||
const title = `time, ${branding}, ${count}, ${name}`; | ||
try { | ||
const innerTime = f(count, body, post); | ||
const record = { | ||
branding, | ||
count, | ||
name, | ||
innerTime, | ||
}; | ||
console.log(JSON.stringify(record, undefined, ' '), '\n,\n'); | ||
} catch (e) { | ||
console.log(`error`, e); | ||
process.exit(1); | ||
} |
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,9 @@ | ||
import 'ses'; | ||
|
||
const argv = process.argv.splice(2); | ||
const [branding, name, count_s] = argv; | ||
const count = Number(count_s); | ||
globalThis.HARDEN_BRANDING = branding; | ||
lockdown({}); | ||
|
||
export { branding, name, count }; |
Oops, something went wrong.