Repository navigation
Conversation
v3 metadata is registered as `[json, externals, name?]`. The AST stays a JSON string until the function is first used. v1 and v2 metadata are still read.
|
pkg.pr.new packages benchmark commit |
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased (max 79.48%) | ❔ Unknown |
|---|---|---|---|
| 0 | 36 | 316 | 0 |
import * as ... in PR vs import * as ... in target (did bundle size increase?):
Click to reveal the results table (149 entries).
| Test | tsdown |
|---|---|
| d_unstruct.ts | 3.03 kB ( |
| tgpu_slot.ts | 3.08 kB ( |
| tgpu_unroll.ts | 3.76 kB ( |
| d_struct.ts | 5.18 kB ( |
| tgpu_computeFn.ts | 45.58 kB ( |
| tgpu_fn.ts | 45.78 kB ( |
| tgpu_vertexFn.ts | 46.13 kB ( |
| tgpu_fragmentFn.ts | 46.32 kB ( |
| d_bool.ts | 20.26 kB ( |
| d_f16.ts | 20.26 kB ( |
| d_f32.ts | 20.26 kB ( |
| d_i32.ts | 20.26 kB ( |
| d_u32.ts | 20.26 kB ( |
| d_ref.ts | 20.27 kB ( |
| d_u16.ts | 20.28 kB ( |
| d_abstractInt.ts | 20.33 kB ( |
| d_abstractFloat.ts | 20.34 kB ( |
| d_textureDepth2d.ts | 20.70 kB ( |
| d_textureDepthCube.ts | 20.71 kB ( |
| d_texture1d.ts | 20.71 kB ( |
| d_texture2d.ts | 20.71 kB ( |
| d_texture3d.ts | 20.71 kB ( |
| d_textureCube.ts | 20.72 kB ( |
| d_textureDepth2dArray.ts | 20.72 kB ( |
| d_textureDepthCubeArray.ts | 20.72 kB ( |
| d_textureDepthMultisampled2d.ts | 20.73 kB ( |
| d_texture2dArray.ts | 20.73 kB ( |
| d_textureCubeArray.ts | 20.74 kB ( |
| d_textureMultisampled2d.ts | 20.74 kB ( |
| common_fullScreenTriangle.ts | 49.01 kB ( |
| std_discard.ts | 21.51 kB ( |
| tgpu_comptime.ts | 21.61 kB ( |
| std_arrayLength.ts | 21.73 kB ( |
| std_copy.ts | 21.75 kB ( |
| std_extensionEnabled.ts | 21.83 kB ( |
| std_range.ts | 22.10 kB ( |
| std_isBeingTranspiled.ts | 22.14 kB ( |
| std_getShaderStage.ts | 22.19 kB ( |
| std_getTargetShaderLanguage.ts | 22.20 kB ( |
| std_typeOf.ts | 22.25 kB ( |
| d_disarrayOf.ts | 22.27 kB ( |
| STATIC_common.ts | 56.56 kB ( |
| std_atomicLoad.ts | 26.38 kB ( |
| std_atomicCompareExchangeWeak.ts | 26.39 kB ( |
| std_atomicExchange.ts | 26.39 kB ( |
| std_atomicStore.ts | 26.39 kB ( |
| std_workgroupBarrier.ts | 26.39 kB ( |
| std_workgroupUniformLoad.ts | 26.39 kB ( |
| std_atomicAdd.ts | 26.39 kB ( |
| std_atomicAnd.ts | 26.39 kB ( |
| std_atomicMax.ts | 26.39 kB ( |
| std_atomicMin.ts | 26.39 kB ( |
| std_atomicOr.ts | 26.39 kB ( |
| std_atomicSub.ts | 26.39 kB ( |
| std_atomicXor.ts | 26.39 kB ( |
| std_storageBarrier.ts | 26.39 kB ( |
| std_textureBarrier.ts | 26.39 kB ( |
| d_uint8.ts | 28.21 kB ( |
| d_float16.ts | 28.22 kB ( |
| d_float16x2.ts | 28.22 kB ( |
| d_float16x4.ts | 28.22 kB ( |
| d_float32.ts | 28.22 kB ( |
| d_float32x2.ts | 28.22 kB ( |
| d_float32x3.ts | 28.22 kB ( |
| d_float32x4.ts | 28.22 kB ( |
| d_sint16.ts | 28.22 kB ( |
| d_sint16x2.ts | 28.22 kB ( |
| d_sint16x4.ts | 28.22 kB ( |
| d_sint32.ts | 28.22 kB ( |
| d_sint32x2.ts | 28.22 kB ( |
| d_sint32x3.ts | 28.22 kB ( |
| d_sint32x4.ts | 28.22 kB ( |
| d_sint8.ts | 28.22 kB ( |
| d_sint8x2.ts | 28.22 kB ( |
| d_sint8x4.ts | 28.22 kB ( |
| d_snorm16.ts | 28.22 kB ( |
| d_snorm16x2.ts | 28.22 kB ( |
| d_snorm16x4.ts | 28.22 kB ( |
| d_snorm8.ts | 28.22 kB ( |
| d_snorm8x2.ts | 28.22 kB ( |
| d_snorm8x4.ts | 28.22 kB ( |
| d_uint16.ts | 28.22 kB ( |
| d_uint16x2.ts | 28.22 kB ( |
| d_uint16x4.ts | 28.22 kB ( |
| d_uint32.ts | 28.22 kB ( |
| d_uint32x2.ts | 28.22 kB ( |
| d_uint32x3.ts | 28.22 kB ( |
| d_uint32x4.ts | 28.22 kB ( |
| d_uint8x2.ts | 28.22 kB ( |
| d_uint8x4.ts | 28.22 kB ( |
| d_unorm10_10_10_2.ts | 28.22 kB ( |
| d_unorm16.ts | 28.22 kB ( |
| d_unorm16x2.ts | 28.22 kB ( |
| d_unorm16x4.ts | 28.22 kB ( |
| d_unorm8.ts | 28.22 kB ( |
| d_unorm8x2.ts | 28.22 kB ( |
| d_unorm8x4.ts | 28.22 kB ( |
| d_unorm8x4_bgra.ts | 28.22 kB ( |
| d_formatToWGSLType.ts | 28.21 kB ( |
| d_packedFormats.ts | 28.24 kB ( |
| d_isPackedData.ts | 28.28 kB ( |
| d_alignmentOf.ts | 29.17 kB ( |
| tgpu_accessor.ts | 68.34 kB ( |
| tgpu_mutableAccessor.ts | 68.35 kB ( |
| d_isBuiltin.ts | 31.89 kB ( |
| d_sizeOf.ts | 31.94 kB ( |
| d_isContiguous.ts | 31.95 kB ( |
| d_getLongestContiguousPrefix.ts | 31.96 kB ( |
| std_subgroupAdd.ts | 32.32 kB ( |
| std_quadBroadcast.ts | 32.33 kB ( |
| std_quadSwapDiagonal.ts | 32.33 kB ( |
| std_quadSwapX.ts | 32.33 kB ( |
| std_quadSwapY.ts | 32.33 kB ( |
| std_subgroupAll.ts | 32.33 kB ( |
| std_subgroupAnd.ts | 32.33 kB ( |
| std_subgroupAny.ts | 32.33 kB ( |
| std_subgroupBallot.ts | 32.33 kB ( |
| std_subgroupBroadcast.ts | 32.33 kB ( |
| std_subgroupBroadcastFirst.ts | 32.33 kB ( |
| std_subgroupElect.ts | 32.33 kB ( |
| std_subgroupExclusiveAdd.ts | 32.33 kB ( |
| std_subgroupExclusiveMul.ts | 32.33 kB ( |
| std_subgroupInclusiveAdd.ts | 32.33 kB ( |
| std_subgroupInclusiveMul.ts | 32.33 kB ( |
| std_subgroupMax.ts | 32.33 kB ( |
| std_subgroupMin.ts | 32.33 kB ( |
| std_subgroupMul.ts | 32.33 kB ( |
| std_subgroupOr.ts | 32.33 kB ( |
| std_subgroupShuffle.ts | 32.33 kB ( |
| std_subgroupShuffleDown.ts | 32.33 kB ( |
| std_subgroupShuffleUp.ts | 32.33 kB ( |
| std_subgroupShuffleXor.ts | 32.33 kB ( |
| std_subgroupXor.ts | 32.33 kB ( |
| d_size.ts | 33.63 kB ( |
| d_align.ts | 33.63 kB ( |
| d_location.ts | 33.63 kB ( |
| d_interpolate.ts | 33.64 kB ( |
| d_arrayOf.ts | 33.69 kB ( |
| tgpu_vertexLayout.ts | 33.95 kB ( |
| d_invariant.ts | 34.01 kB ( |
| std_identity2.ts | 34.42 kB ( |
| std_identity3.ts | 34.42 kB ( |
| std_identity4.ts | 34.42 kB ( |
| std_rotationX4.ts | 34.42 kB ( |
| std_rotationY4.ts | 34.42 kB ( |
| std_rotationZ4.ts | 34.42 kB ( |
| std_scaling4.ts | 34.42 kB ( |
| std_translation4.ts | 34.42 kB ( |
| common_writeSoA.ts | 34.55 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [1.09, 2.21, 4.56, 7.42, 8.91, 13.62, 27.60, 27.69]
line [1.14, 2.24, 4.96, 6.94, 9.29, 15.65, 27.57, 28.01]
line [1.07, 2.25, 4.47, 7.52, 9.20, 12.87, 28.15, 27.23]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.31, 0.54, 0.75, 0.92, 1.24, 1.29, 1.53, 1.66]
line [0.32, 0.54, 0.79, 0.98, 1.32, 1.38, 1.56, 1.76]
line [0.34, 0.56, 0.77, 0.91, 1.23, 1.30, 1.57, 1.69]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [1.00, 2.96, 4.76, 8.55, 15.08, 28.88, 61.79, 125.31]
line [0.93, 2.29, 4.38, 7.88, 14.49, 30.22, 63.34, 127.36]
line [0.95, 2.35, 3.91, 7.91, 14.47, 28.57, 60.51, 126.17]
|
I'm introducing that in #2913 nodes/types look like that: export type ObjectPattern = readonly [
type: NodeTypeCatalog['objectPattern'],
props: readonly [name: string, binding: BindingElement][],
];
export type BindingPattern = ObjectPattern;
export type BindingName = Identifier | BindingPattern;
export type BindingElement = BindingName;
export type FuncParameter = LegacyFuncParameter | BindingElement;Destructured params are It lets us add new kinds of destructuring, default parameters, and rest element without breaking changes in AST, finally it could look like that: export type ObjectPatternEntry =
| readonly [name: string, binding: BindingElement]
| RestElement<Identifier>;
export type ObjectPattern = readonly [
type: NodeTypeCatalog['objectPattern'],
props: readonly ObjectPatternEntry[],
];
export type BindingPattern = ObjectPattern | ArrayPattern;
export type BindingName = Identifier | BindingPattern;
export type BindingElement = BindingName | AssignmentPattern;
export type FuncParameter = BindingElement | RestElement;tldrShould I include this change in #2913, or leave it for this PR? |
Part of a stack that makes the metadata of
'use gpu'functions smaller and cheaper to load (#3246).typegpu can now read metadata registered as
[json, externals, name?](v3), which the plugin starts emitting in #3246. v1 and v2 are still read, so code transformed by older plugin versions keeps working.jsonholds[params, statements]. It's parsed on first use (getFunctionMetadata), not when the bundle loads."a"instead of{"type":"i","name":"a"}). Destructured params are[name, alias][].getNamereads the name from either shape without parsing the AST.Cost: the reader adds 549–578 B minified / 175–222 B gzip to an app. That's measured on four docs examples built with Vite 8, against
main(setup in #3248). #3246 saves more than that in every one of them.