-
Notifications
You must be signed in to change notification settings - Fork 0
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
fae1708
commit fae1c10
Showing
6 changed files
with
74 additions
and
97 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,22 @@ | ||
name: Do the thing in CI | ||
|
||
on: | ||
push: | ||
branches: ['master'] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-all: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# clone | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
# install dependencies | ||
- uses: extractions/setup-just@v1 | ||
- uses: oven-sh/setup-bun@v1 | ||
# checks | ||
- run: just setup | ||
- run: just count |
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 @@ | ||
registry=https://registry.npmjs.org/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
import { readFile } from 'fs/promises'; | ||
import { readdirSync } from 'fs'; | ||
import { join } from 'path'; | ||
import yaml from 'js-yaml'; | ||
import formatTime from 'pretty-time'; | ||
import formatSize from 'pretty-bytes'; | ||
|
||
const resultsDir = './results'; | ||
const results = await Promise.all( | ||
readdirSync(resultsDir).map(async (name) => { | ||
const text = await readFile(join(resultsDir, name), 'utf-8'); | ||
const json = yaml.load(text.replace(/INFO \[timers\] /g, '').replace(/ -$/gm, ' null')); | ||
const json = JSON.parse(text.replace(/INFO \[timers\] /g, '').replace(/ -$/gm, ' null')); | ||
|
||
const rss_split = json['max_rss'].indexOf(' '); | ||
console.log(json); | ||
return { | ||
name: [name, json['cmdline']].join(' :: '), | ||
real: parseInt(json['real'].replace('ns', '')), | ||
rss: parseInt(json['max_rss'].substring(0, rss_split)), | ||
rss_fmt: json['max_rss'].substring(rss_split), | ||
name: [name, json.command].join(' :: '), | ||
...json | ||
}; | ||
}) | ||
); | ||
|
||
console.table( | ||
results | ||
.slice() | ||
.sort((a, b) => a.real - b.real) | ||
.map(({ name, real }) => ({ name, real: formatTime(real) })) | ||
.sort((a, b) => a.mean - b.mean) | ||
.map(({ name, mean }) => ({ | ||
name, | ||
mean: formatTime(Math.floor(mean * 1_000_000_000), undefined, 5), | ||
})) | ||
); | ||
|
||
console.table( | ||
results | ||
.slice() | ||
.sort((a, b) => a.rss - b.rss) | ||
.map(({ name, rss }) => ({ name, rss: formatSize(rss, { minimumFractionDigits: 7 }) })) | ||
.sort((a, b) => a.max_rss - b.max_rss) | ||
.map(({ name, max_rss }) => ({ name, max_rss: formatSize(max_rss, { minimumFractionDigits: 7 }) })) | ||
); |