-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Improve binary performance and codspeed ci (#1667)
* chore: optimize binary size * chore: bump version * chore: optimize binary size * chore: add cargo test ci * chore: test codspeed * chore: test codspeed * chore: update ci * chore: update bench * chore: update bench * chore: update bench * chore: update bench * chore: update bench * chore: update workspace * chore: update workspace * chore: update bench * chore: update bench * chore: update bench * chore: update ci * chore: update ci * chore: update ci * chore: update ci * chore: update ci * chore: update ci * chore: update ci * chore: update ci * chore: update ci
- Loading branch information
Showing
17 changed files
with
774 additions
and
328 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,5 @@ | ||
--- | ||
"@farmfe/core": patch | ||
--- | ||
|
||
chore: Improve binary performance |
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,45 @@ | ||
name: codspeed-benchmarks | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
# `workflow_dispatch` allows CodSpeed to trigger backtest | ||
# performance analysis in order to generate initial data. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
call-rust-build: | ||
uses: ./.github/workflows/rust-build.yaml | ||
|
||
benchmarks: | ||
needs: [call-rust-build] | ||
runs-on: ${{ matrix.settings.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
settings: | ||
- os: ubuntu-latest | ||
abi: linux-x64-gnu | ||
steps: | ||
- uses: "actions/checkout@v3" | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install Dependencies | ||
run: npm install -g [email protected] && pnpm i --frozen-lockfile | ||
- name: Build CLI and Core | ||
run: pnpm --filter @farmfe/cli run build | ||
- uses: actions/download-artifact@v3 | ||
id: download | ||
with: | ||
name: ${{ github.sha }}-${{ matrix.settings.abi }} | ||
path: ./packages/core/binding | ||
- name: Build Core CJS | ||
run: cd packages/core && pnpm run build:cjs | ||
- name: Run benchmarks | ||
uses: CodSpeedHQ/action@v3 | ||
with: | ||
run: npm exec vitest bench | ||
token: ${{ secrets.CODSPEED_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
[workspace] | ||
members = [ | ||
"crates/*", | ||
"packages/create-farm", | ||
"rust-plugins/*", | ||
] | ||
members = ["crates/*", "packages/create-farm", "rust-plugins/*"] | ||
resolver = "2" | ||
|
||
[workspace.package] | ||
edition = "2021" | ||
homepage = "https://farmfe.org" | ||
license = "MIT" | ||
repository = "https://github.com/farm-fe/farm" | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
lto = "fat" | ||
opt-level = 3 | ||
strip = true | ||
panic = "abort" | ||
|
||
[profile.ci-test] | ||
inherits = "release" | ||
opt-level = 0 | ||
debug = 2 | ||
lto = false | ||
codegen-units = 16 |
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,25 @@ | ||
import path from 'node:path'; | ||
import { bench, describe } from 'vitest'; | ||
import { build } from '@farmfe/core'; | ||
|
||
async function build_react_example() { | ||
await build({ | ||
root: path.resolve(process.cwd(), './examples/react'), | ||
configPath: path.resolve('./examples/react'), | ||
compilation: { input: {}, output: {} } | ||
}); | ||
} | ||
|
||
describe('react_example_bench', () => { | ||
let hasRun = false; | ||
bench( | ||
'build_react_example', | ||
async () => { | ||
if (!hasRun) { | ||
await build_react_example(); | ||
hasRun = true; | ||
} | ||
}, | ||
{ warmupIterations: 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,12 @@ | ||
{ | ||
"name": "bench", | ||
"version": "1.0.0", | ||
"description": "", | ||
"scripts": {}, | ||
"dependencies": { | ||
"@farmfe/core": "workspace:*" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC" | ||
} |
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,6 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
import codspeedPlugin from '@codspeed/vitest-plugin'; | ||
|
||
export default defineConfig({ | ||
plugins: [codspeedPlugin()] | ||
}); |
Oops, something went wrong.