Skip to content

Commit

Permalink
feat(cli): add --zig-link-only option
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Dec 19, 2022
1 parent ef5dffc commit e843fde
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cli/src/build.ts
Expand Up @@ -191,6 +191,10 @@ export class BuildCommand extends Command {
)} ${chalk.green('--zig-abi-suffix=2.17')}`,
})

zigLinkOnly = Option.Boolean(`--zig-link-only`, false, {
description: `Only link the library with ${chalk.green('zig')}`,
})

isStrip = Option.Boolean(`--strip`, false, {
description: `${chalk.green('Strip')} the library for minimum file size`,
})
Expand Down Expand Up @@ -402,12 +406,14 @@ export class BuildCommand extends Command {
},
)
const envTarget = triple.raw.replaceAll('-', '_').toUpperCase()
Object.assign(additionalEnv, {
CC: CCWrapperShell,
CXX: CXXWrapperShell,
TARGET_CC: CCWrapperShell,
TARGET_CXX: CXXWrapperShell,
})
if (!this.zigLinkOnly) {
Object.assign(additionalEnv, {
CC: CCWrapperShell,
CXX: CXXWrapperShell,
TARGET_CC: CCWrapperShell,
TARGET_CXX: CXXWrapperShell,
})
}
additionalEnv[`CARGO_TARGET_${envTarget}_LINKER`] = linkerWrapperShell
}
debug(`Platform: ${JSON.stringify(triple, null, 2)}`)
Expand Down

1 comment on commit e843fde

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: e843fde Previous: 1bcb3a3 Ratio
noop#napi-rs 64358588 ops/sec (±0.18%) 67886679 ops/sec (±0.2%) 1.05
noop#JavaScript 590585737 ops/sec (±0.44%) 593286083 ops/sec (±0.11%) 1.00
Plus number#napi-rs 20195334 ops/sec (±0.16%) 20807212 ops/sec (±0.19%) 1.03
Plus number#JavaScript 590593870 ops/sec (±0.14%) 592249498 ops/sec (±0.11%) 1.00
Create buffer#napi-rs 444275 ops/sec (±7.29%) 438105 ops/sec (±6.31%) 0.99
Create buffer#JavaScript 1915906 ops/sec (±4.61%) 1925959 ops/sec (±5.09%) 1.01
createArray#createArrayJson 44294 ops/sec (±0.11%) 44407 ops/sec (±0.18%) 1.00
createArray#create array for loop 8163 ops/sec (±0.12%) 8253 ops/sec (±0.09%) 1.01
createArray#create array with serde trait 8235 ops/sec (±0.11%) 8259 ops/sec (±0.1%) 1.00
getArrayFromJs#get array from json string 18641 ops/sec (±0.14%) 18702 ops/sec (±0.28%) 1.00
getArrayFromJs#get array from serde 10645 ops/sec (±0.08%) 10682 ops/sec (±0.08%) 1.00
getArrayFromJs#get array with for loop 13044 ops/sec (±0.06%) 13208 ops/sec (±0.07%) 1.01
Get Set property#Get Set from native#u32 410372 ops/sec (±4.92%) 404159 ops/sec (±4.76%) 0.98
Get Set property#Get Set from JavaScript#u32 338785 ops/sec (±5.02%) 335221 ops/sec (±4.55%) 0.99
Get Set property#Get Set from native#string 365548 ops/sec (±4.84%) 370818 ops/sec (±4.39%) 1.01
Get Set property#Get Set from JavaScript#string 325478 ops/sec (±5.02%) 317602 ops/sec (±4.64%) 0.98
Async task#spawn task 34731 ops/sec (±0.64%) 35127 ops/sec (±0.84%) 1.01
Async task#ThreadSafeFunction 2098 ops/sec (±9.79%) 2948 ops/sec (±2.45%) 1.41
Async task#Tokio future to Promise 30507 ops/sec (±3.05%) 30375 ops/sec (±2.81%) 1.00
Query#query * 100 1907 ops/sec (±5.9%) 2003 ops/sec (±3.82%) 1.05
Query#query * 1 31236 ops/sec (±0.64%) 30155 ops/sec (±5.72%) 0.97

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.