mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-21 02:40:08 +00:00
benchmark test (#2830)
* ci: test
* ci: add script
* ci: change to js
* ci: test
* ci: fix error
* ci: fix script
* chore: add benchmark
* ci: fix need input
* fix: read file with dir
* ci: change push to trigger on main only
* ci: try new method
* ci: fix "true"
* chore: fix set output
* fix: set output
* ci: increase number of try
* chore: clean up dir
* fix needs
* bench: add memory bench
* bench: import memory bench
* bench: fix v19 syntax
* bench: more fix
* bench: add filter
* bench: minor fix
* ci: read file in sync
* chore: yarn install
* chore: add db to ignore
* refactor(bench): use loader
* bench: only bench on one event
* bench: add type to db event
* chore(bench): better type
* bench: add rest simplifyUrl bench
* chore: add microtime
* refactor: add fall back
* Revert "ci: change push to trigger on main only"
This reverts commit 04df971025.
* chore: yarn install
* ci: trigger push event only on main branch
* chore(bench): use node-fetch
* refactor(bench): make it work with other function and event
* chore(bench): better name
This commit is contained in:
12
scripts/checkCpuModel.js
Normal file
12
scripts/checkCpuModel.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
|
||||
const hostCpu = os.cpus()[0].model.trim()
|
||||
const targetCpu = await fetch('https://raw.githubusercontent.com/discordeno/discordeno/benchies/cpu')
|
||||
.then((res) => res.text())
|
||||
.then((text) => text.slice(0, -1))
|
||||
console.dir(`host cpu: ${hostCpu} target cpu: ${targetCpu}`)
|
||||
|
||||
let outputFile = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8')
|
||||
outputFile += `\nmatch=${hostCpu === targetCpu}`
|
||||
fs.writeFileSync(process.env.GITHUB_OUTPUT, outputFile, 'utf8')
|
||||
@@ -3,19 +3,13 @@ import fs from 'node:fs'
|
||||
const dirs = ['']
|
||||
for await (const dir of dirs) {
|
||||
await Promise.all(
|
||||
fs.readdirSync(`benchDist${dir}`).map(async (file) => {
|
||||
if (!file.endsWith('.js')) {
|
||||
fs.readdirSync(`dist${dir}`).map(async (file) => {
|
||||
if (!file.endsWith('.js') && !file.endsWith('.map') && !file.endsWith('.ts')) {
|
||||
dirs.push(`${dir}/${file}`)
|
||||
return
|
||||
}
|
||||
const content = await fs.promises.readFile(
|
||||
`benchDist${dir}/${file}`,
|
||||
'utf-8'
|
||||
)
|
||||
fs.promises.writeFile(
|
||||
`benchDist${dir}/${file}`,
|
||||
content.replace(/src\//g, 'dist/').replace(/\.ts/g, '.js')
|
||||
)
|
||||
})
|
||||
const content = await fs.promises.readFile(`dist${dir}/${file}`, 'utf-8')
|
||||
fs.promises.writeFile(`dist${dir}/${file}`, content.replace(/src\//g, 'dist/').replace(/\.ts/g, '.js'))
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user