Skip to content

Conversation

@mateuszsikora
Copy link
Contributor

@mateuszsikora mateuszsikora commented Dec 17, 2025

I added option to run accumulation sequentially. It makes traces more readable.

without --accumulate-sequentially:
Screenshot 2025-12-17 at 11 53 28

with --accumulate-sequentially (logs are duplicated because of two pvm interpreters):
Screenshot 2025-12-17 at 11 59 26

it resolves #804

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added an accumulateSequentially configuration and corresponding --accumulate-sequentially CLI flag to control sequential vs parallel accumulation
    • Runtime notification when sequential accumulation mode is enabled
  • Tests

    • Expanded test coverage to validate both sequential and parallel accumulation modes and help output
  • Chores

    • Updated tooling and configuration wiring to propagate the new accumulation option throughout the system

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This PR adds an accumulateSequentially boolean option and threads it through the test runner CLI, test preparation, and core accumulation paths. Accumulate and OnChain constructors now accept an options object (AccumulateOptions) containing pvm and accumulateSequentially; callers (test runner, chain-stf, importer, w3f accumulate tests) are updated to pass that object. Accumulate's internal flow now conditionally awaits per-service accumulation when sequential mode is requested. Tests are parameterized to run with both sequential and parallel accumulation modes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify conditional awaiting logic in packages/jam/transition/accumulate/accumulate.ts for correctness and side-effects.
  • Confirm constructor signature changes for Accumulate and OnChain are consistently applied across call sites (chain-stf, state-transition, importer, test runner).
  • Review test changes in packages/jam/transition/accumulate/accumulate.test.ts and bin/test-runner/common.{ts, test.ts} to ensure CLI option propagation and both variants are exercised.
  • Check new AccumulateOptions type and index re-export for correct typing and public API surface.

Possibly related PRs

Suggested reviewers

  • skoszuta
  • tomusdrw
  • DrEverr

Poem

🐰 I hopped through options, pvm in my paw,
Threaded sequential flags without a flaw.
Parallel or ordered, the tests now can show,
Cleaner traces hop where the async once did go.
A tiny rabbit cheer for orderly flow! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding an option to run accumulation sequentially, which matches the primary objective of this PR.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of the sequential accumulation option, showing its effect on trace readability, and linking to the related issue #804.
Linked Issues check ✅ Passed All code changes directly implement the objective from issue #804: providing a configurable option for synchronous/sequential accumulation by adding --accumulate-sequentially flag, threading it through the codebase, and implementing conditional sequential behavior.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the sequential accumulation feature: CLI flag parsing, type definitions, constructor updates, and runtime behavior changes. Minor formatting adjustments in test files are incidental to the feature.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ms-sequential-accumulation-option

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/jam/node/jam-config.ts (1)

75-76: Consider clarifying the comment.

The comment "Disable parallel accumulation" describes the effect when the flag is true, but it might be clearer to describe the flag's purpose more directly. Consider:

-    /** Disable parallel accumulation */
+    /** When true, run accumulation sequentially instead of in parallel */
     public readonly accumulateSequentially: boolean,

This more clearly indicates the flag's semantics and when each behavior applies.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad8249b and 0fdc12e.

📒 Files selected for processing (22)
  • bin/jam/args.test.ts (1 hunks)
  • bin/jam/args.ts (4 hunks)
  • bin/jam/index.ts (1 hunks)
  • bin/rpc/test/e2e-setup.ts (1 hunks)
  • bin/tci/index.test.ts (1 hunks)
  • bin/tci/index.ts (1 hunks)
  • bin/test-runner/common.test.ts (2 hunks)
  • bin/test-runner/common.ts (6 hunks)
  • bin/test-runner/state-transition/state-transition.ts (1 hunks)
  • bin/test-runner/w3f/accumulate.ts (2 hunks)
  • packages/jam/config-node/node-config.ts (1 hunks)
  • packages/jam/node/jam-config.ts (4 hunks)
  • packages/jam/node/main-importer.ts (2 hunks)
  • packages/jam/node/main.ts (1 hunks)
  • packages/jam/transition/accumulate/accumulate.test.ts (1 hunks)
  • packages/jam/transition/accumulate/accumulate.ts (5 hunks)
  • packages/jam/transition/accumulate/index.ts (1 hunks)
  • packages/jam/transition/accumulate/options.ts (1 hunks)
  • packages/jam/transition/chain-stf.ts (5 hunks)
  • packages/workers/importer/importer.ts (3 hunks)
  • packages/workers/importer/main.ts (1 hunks)
  • packages/workers/importer/protocol.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.ts

⚙️ CodeRabbit configuration file

**/*.ts: rules from ./CODESTYLE.md should be adhered to.

**/*.ts: Any function whose documentation mention it must not be used in production code,
can be safely used in *.test.ts files. Other usage should be carefuly reviewed
and the comment must explain why it's safe to use there.

**/*.ts: as conversions must not be used. Suggest using tryAs conversion methods.

**/*.ts: Classes with static Codec field must have private constructor and static create method.

**/*.ts: Casting a bigint (or U64) using Number(x) must have an explanation comment why
it is safe.

**/*.ts: When making changes to code with comments containing links (in classes, constants, methods, etc.)
to graypaper.fluffylabs.dev, ensure those links point to the current version for this update.

Files:

  • packages/jam/config-node/node-config.ts
  • bin/test-runner/common.test.ts
  • bin/tci/index.ts
  • bin/rpc/test/e2e-setup.ts
  • packages/jam/node/main-importer.ts
  • packages/workers/importer/protocol.ts
  • bin/test-runner/common.ts
  • packages/jam/transition/accumulate/options.ts
  • packages/workers/importer/importer.ts
  • bin/jam/args.test.ts
  • bin/test-runner/state-transition/state-transition.ts
  • packages/workers/importer/main.ts
  • packages/jam/transition/accumulate/accumulate.ts
  • packages/jam/node/main.ts
  • bin/jam/args.ts
  • bin/jam/index.ts
  • packages/jam/node/jam-config.ts
  • packages/jam/transition/accumulate/index.ts
  • packages/jam/transition/accumulate/accumulate.test.ts
  • bin/tci/index.test.ts
  • bin/test-runner/w3f/accumulate.ts
  • packages/jam/transition/chain-stf.ts
🧠 Learnings (2)
📚 Learning: 2025-11-03T10:12:27.580Z
Learnt from: tomusdrw
Repo: FluffyLabs/typeberry PR: 757
File: packages/jam/state-vectors/index.ts:18-36
Timestamp: 2025-11-03T10:12:27.580Z
Learning: In TypeScript files, the coding guideline requiring classes with `static Codec` field to have a private constructor and static `create` method applies specifically to classes using `codec.Class`. When using `codec.object`, this pattern is not required because the code only cares about the shape, not the instance.

Applied to files:

  • packages/workers/importer/protocol.ts
📚 Learning: 2025-04-24T19:48:31.051Z
Learnt from: tomusdrw
Repo: FluffyLabs/typeberry PR: 351
File: packages/jam/state-merkleization/index.ts:19-37
Timestamp: 2025-04-24T19:48:31.051Z
Learning: In the typeberry codebase, `Bytes` inherits from `BytesBlob`, so a `Bytes` instance can be directly used where a `BytesBlob` is expected without needing conversion.

Applied to files:

  • packages/jam/transition/accumulate/accumulate.ts
🧬 Code graph analysis (13)
bin/tci/index.ts (1)
packages/jam/config-node/node-config.ts (1)
  • NODE_DEFAULTS (19-24)
bin/rpc/test/e2e-setup.ts (2)
packages/jam/node/jam-config.ts (1)
  • JamConfig (22-78)
packages/jam/config-node/node-config.ts (1)
  • NODE_DEFAULTS (19-24)
packages/workers/importer/protocol.ts (2)
packages/core/codec/descriptor.ts (1)
  • CodecRecord (13-15)
packages/jam/transition/accumulate/accumulate.ts (1)
  • accumulateSequentially (364-432)
bin/test-runner/common.ts (1)
packages/jam/transition/accumulate/accumulate.ts (1)
  • accumulateSequentially (364-432)
packages/workers/importer/importer.ts (2)
packages/jam/transition/accumulate/options.ts (1)
  • AccumulateOptions (3-6)
packages/jam/transition/chain-stf.ts (1)
  • OnChain (122-436)
bin/jam/args.test.ts (1)
packages/jam/config-node/node-config.ts (1)
  • NODE_DEFAULTS (19-24)
bin/test-runner/state-transition/state-transition.ts (1)
packages/jam/transition/chain-stf.ts (2)
  • OnChain (122-436)
  • DbHeaderChain (45-75)
packages/workers/importer/main.ts (1)
packages/workers/importer/importer.ts (1)
  • Importer (29-204)
packages/jam/transition/accumulate/accumulate.ts (1)
packages/jam/transition/accumulate/options.ts (1)
  • AccumulateOptions (3-6)
packages/jam/node/jam-config.ts (1)
packages/jam/transition/accumulate/accumulate.ts (1)
  • accumulateSequentially (364-432)
packages/jam/transition/accumulate/accumulate.test.ts (5)
packages/jam/config/pvm-backend.ts (1)
  • PvmBackendNames (2-2)
packages/jam/block/common.ts (4)
  • EntropyHash (40-40)
  • tryAsTimeSlot (18-18)
  • tryAsServiceId (28-28)
  • ServiceId (26-26)
packages/jam/config/chain-spec.ts (1)
  • tinyChainSpec (109-126)
packages/jam/block/refine-context.ts (1)
  • WorkPackageHash (18-18)
packages/jam/block/gp-constants.ts (1)
  • MIN_PUBLIC_SERVICE_INDEX (64-64)
bin/tci/index.test.ts (1)
packages/jam/config-node/node-config.ts (1)
  • NODE_DEFAULTS (19-24)
bin/test-runner/w3f/accumulate.ts (3)
bin/test-runner/common.ts (1)
  • RunOptions (95-100)
packages/jam/transition/accumulate/accumulate.ts (1)
  • Accumulate (84-740)
packages/core/hash/blake2b.ts (1)
  • Blake2b (8-44)
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Setup test vectors cache
  • GitHub Check: benchmarks (22.x)
  • GitHub Check: test (22.x)
  • GitHub Check: e2e (22.x)
🔇 Additional comments (42)
packages/jam/transition/accumulate/options.ts (1)

1-6: LGTM!

The type definition is clean and appropriate for threading accumulation options through the system. The structure clearly groups the PVM backend choice with the sequential accumulation flag.

bin/test-runner/w3f/accumulate.ts (3)

140-140: LGTM!

The function signature correctly destructures accumulateSequentially from RunOptions, aligning with the type definition shown in the relevant code snippets.


143-144: LGTM!

The options object is correctly constructed with both pvm and accumulateSequentially fields, matching the AccumulateOptions type definition.


155-155: LGTM!

The Accumulate constructor call correctly passes the options object as the fourth parameter, matching the updated constructor signature shown in the relevant code snippets.

bin/test-runner/common.test.ts (1)

15-15: LGTM!

The test expectations correctly include accumulateSequentially: false, matching the default value established in NODE_DEFAULTS and the updated structure of parseArgs return type.

Also applies to: 27-27

bin/tci/index.ts (1)

88-88: LGTM!

The accumulateSequentially field is correctly propagated from NODE_DEFAULTS into the JamConfig creation, maintaining consistency with the default configuration values.

packages/jam/transition/accumulate/index.ts (1)

4-4: LGTM!

The export statement appropriately extends the public API surface to include the new AccumulateOptions type, enabling downstream consumers to import it from the main accumulate module.

packages/jam/node/jam-config.ts (2)

32-32: LGTM!

The parameter is correctly added to the JamConfig.new factory method with an appropriate default value of false (parallel accumulation by default) and proper type annotation.

Also applies to: 43-43


54-54: LGTM!

The accumulateSequentially parameter is correctly passed through to the private constructor.

bin/jam/index.ts (1)

91-91: LGTM!

The accumulateSequentially flag is correctly propagated from the parsed CLI arguments through to the JamConfig construction, completing the configuration pipeline from command-line input to runtime config.

packages/jam/config-node/node-config.ts (1)

23-23: LGTM!

The default value of false is appropriate, maintaining parallel accumulation as the default behavior for performance reasons while allowing users to opt into sequential mode for trace readability.

bin/jam/args.test.ts (1)

15-15: LGTM!

The addition of accumulateSequentially to the default options correctly propagates the new configuration field from NODE_DEFAULTS into the test expectations.

bin/rpc/test/e2e-setup.ts (1)

14-19: LGTM!

The accumulateSequentially parameter is correctly added to the JamConfig.new call, properly sourced from NODE_DEFAULTS. The formatting is consistent with the existing parameter structure.

packages/workers/importer/importer.ts (3)

2-2: LGTM!

The import updates correctly reflect the refactoring from using a bare PvmBackend to the richer AccumulateOptions type, which encapsulates both the PVM backend and the sequential accumulation flag.

Also applies to: 7-7


41-41: LGTM!

The constructor parameter change from pvm: PvmBackend to options: AccumulateOptions is a clean refactoring that enables passing both the PVM backend and the sequential accumulation flag through a single options object.


55-55: LGTM!

The OnChain instantiation correctly passes the options object (containing both pvm and accumulateSequentially) as the fourth parameter, aligning with the updated OnChain constructor signature.

packages/jam/node/main-importer.ts (2)

35-43: LGTM!

The accumulateSequentially flag is correctly propagated from config.accumulateSequentially into the InMemWorkerConfig worker parameters.


44-53: LGTM!

The accumulateSequentially flag is correctly propagated from config.accumulateSequentially into the LmdbWorkerConfig worker parameters, maintaining consistency with the in-memory configuration path.

bin/tci/index.test.ts (1)

20-20: LGTM!

The accumulateSequentially parameter is correctly added to the test's JamConfig.new call, properly sourced from NODE_DEFAULTS.accumulateSequentially.

packages/jam/node/main.ts (1)

63-67: LGTM!

The accumulateSequentially flag is correctly propagated from config.accumulateSequentially into the ImporterConfig.create call within the worker parameters.

packages/jam/transition/accumulate/accumulate.test.ts (2)

49-52: LGTM!

The test parameterization properly covers both sequential (true) and parallel (false) accumulation modes by iterating over the accumulateSequentially values for each PVM backend. The options object is correctly constructed with both pvm and accumulateSequentially fields, and the test suite name clearly indicates which mode is being tested.


197-197: LGTM!

The Accumulate constructor is correctly invoked with the options object (containing both pvm and accumulateSequentially), ensuring both accumulation modes are tested with the same test logic.

Also applies to: 300-300

bin/jam/args.ts (4)

32-34: LGTM!

The help text clearly describes the --accumulate-sequentially option and its default value. The description "Disable parallel accumulation" effectively conveys the purpose of the flag.


55-55: LGTM!

The SharedOptions type is correctly extended with the accumulateSequentially: boolean field, enabling the flag to be propagated through the configuration system.


111-118: LGTM!

The accumulateSequentially flag is correctly parsed using the new parseBooleanOption helper and included in the returned SharedOptions object. The parsing logic properly handles the boolean CLI flag by checking if the value is true (when the flag is present without an explicit value).


212-216: LGTM!

The parseBooleanOption helper function correctly implements boolean flag parsing for minimist. It checks if the option value is true (indicating the flag was present), deletes the option from the args object to prevent it from being flagged as unrecognized, and returns the boolean result.

packages/workers/importer/main.ts (1)

24-32: LGTM!

The options object is correctly constructed and passed to the Importer constructor, aligning with the AccumulateOptions type. The refactoring cleanly bundles pvm and accumulateSequentially into a single configuration object.

bin/test-runner/state-transition/state-transition.ts (1)

100-106: LGTM!

The OnChain constructor correctly receives the options object containing pvm and accumulateSequentially. This aligns with the updated constructor signature and properly propagates the sequential accumulation flag from the test runner options.

packages/workers/importer/protocol.ts (1)

81-106: LGTM!

The ImporterConfig class correctly follows the coding guideline requiring classes with static Codec to have a private constructor and static create method. The new accumulateSequentially field is properly added to the codec, factory method, and constructor.

packages/jam/transition/accumulate/accumulate.ts (2)

84-94: LGTM!

The constructor refactoring from a single pvm parameter to an AccumulateOptions object is clean. The warning log when sequential mode is enabled provides helpful visibility for debugging trace readability issues.


540-544: Sequential accumulation implementation looks correct.

The approach of conditionally awaiting each promise when accumulateSequentially is true effectively converts parallel execution to sequential while still collecting all results via Promise.all. Since each promise is already resolved by the time it's added to resultPromises, the final Promise.all just aggregates the results.

bin/test-runner/common.ts (6)

35-38: LGTM!

The GlobalsOptions type is correctly extended with the new accumulateSequentially boolean field.


95-100: LGTM!

The RunOptions type correctly includes the accumulateSequentially field for propagation to test execution.


139-149: LGTM!

The CLI argument parsing correctly handles --accumulate-sequentially flag. Using === true is appropriate for minimist's boolean handling.


172-186: LGTM!

The main function correctly accepts and destructures accumulateSequentially from the options parameter.


242-245: LGTM!

The accumulateSequentially option is correctly bundled into globalOptions when calling prepareTest.


418-427: LGTM!

The accumulateSequentially flag is correctly propagated from globalOptions to the RunOptions passed to test functions, completing the option flow from CLI through to test execution.

packages/jam/transition/chain-stf.ts (5)

5-6: LGTM: Import refactoring is correct.

The split between type-only import (ChainSpec) and value import (PvmBackend) is appropriate. The value import of PvmBackend is necessary for the enum indexing operation at line 301.


32-32: LGTM: AccumulateOptions type import is correct.

The import is consistent with the refactoring to centralize PVM backend configuration and the new sequential accumulation flag under a single options object.


152-152: LGTM: Constructor refactoring improves API design.

The change from accepting a direct PvmBackend parameter to an AccumulateOptions object is a clean refactoring that supports the new sequential accumulation feature. The options pattern provides better extensibility and encapsulation.


167-169: LGTM: Initialization logic correctly propagates dependencies.

The change correctly passes the full options object to Accumulate (which needs both pvm and accumulateSequentially) while extracting only options.pvm for DeferredTransfers (which only needs the backend type).


301-301: No issues found. The code correctly references this.accumulate.options.pvm for runtime logging. The Accumulate class exposes options as a public field (declared in the constructor), and AccumulateOptions includes the pvm field, making the access pattern safe and valid.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
bin/test-runner/common.ts (1)

185-191: Consider simplifying or removing the redundant helper.

The getBooleanOption helper is trivial and used only twice. Since minimist already handles boolean parsing with the configuration provided, you could directly use parsed[OPTION] (or !!parsed[OPTION] for explicit coercion).

🔎 Proposed simplification
-  const shouldShowHelp = getBooleanOption(parsed[HELP_OPTION]);
+  const shouldShowHelp = !!parsed[HELP_OPTION];
 
   if (shouldShowHelp) {
     console.log(HELP_MESSAGE);
     process.exit(0);
   }
 
   const pvms = getPvms(parsed[PVM_OPTION]);
-  const accumulateSequentially = getBooleanOption(parsed[ACCUMULATE_SEQUENTIALLY_OPTION]);
+  const accumulateSequentially = !!parsed[ACCUMULATE_SEQUENTIALLY_OPTION];
 
   return {
     initialFiles: parsed._,
     pvms,
     accumulateSequentially,
   };
-
-  function getBooleanOption(value: unknown): boolean {
-    if (value === true) {
-      return true;
-    }
-
-    return false;
-  }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7d85f7 and 3a8ad45.

📒 Files selected for processing (2)
  • bin/test-runner/common.test.ts (4 hunks)
  • bin/test-runner/common.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • bin/test-runner/common.test.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.ts

⚙️ CodeRabbit configuration file

**/*.ts: rules from ./CODESTYLE.md should be adhered to.

**/*.ts: Any function whose documentation mention it must not be used in production code,
can be safely used in *.test.ts files. Other usage should be carefuly reviewed
and the comment must explain why it's safe to use there.

**/*.ts: as conversions must not be used. Suggest using tryAs conversion methods.

**/*.ts: Classes with static Codec field must have private constructor and static create method.

**/*.ts: Casting a bigint (or U64) using Number(x) must have an explanation comment why
it is safe.

**/*.ts: When making changes to code with comments containing links (in classes, constants, methods, etc.)
to graypaper.fluffylabs.dev, ensure those links point to the current version for this update.

Files:

  • bin/test-runner/common.ts
🧬 Code graph analysis (1)
bin/test-runner/common.ts (1)
packages/jam/transition/accumulate/accumulate.ts (1)
  • accumulateSequentially (364-432)
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Setup test vectors cache
  • GitHub Check: test (22.x)
  • GitHub Check: e2e (22.x)
🔇 Additional comments (3)
bin/test-runner/common.ts (3)

139-160: Excellent addition of comprehensive help documentation.

This help message directly addresses the past review comment requesting help documentation. The structure is clear, includes all options with defaults, and provides useful examples.


37-37: LGTM! Clean propagation of the new option through the test runner.

The accumulateSequentially option is correctly:

  • Added to GlobalsOptions and RunOptions types
  • Accepted in main function parameters
  • Threaded through prepareTestcreateTestDefinitions → test execution
  • Made available to test runners via RunOptions

This implementation maintains type safety and follows the existing pattern for option propagation.

Also applies to: 99-99, 220-220, 227-227, 284-287, 466-466


162-184: End-to-end propagation of accumulateSequentially is correctly implemented.

The argument parsing extracts accumulateSequentially with a default of false and threads it through mainprepareTestcreateTestDefinitions → test execution. Downstream components (Accumulate constructor at line 91 and OnChain initialization) properly receive the option via AccumulateOptions and conditionally apply sequential accumulation logic (see packages/jam/transition/accumulate/accumulate.ts:540 for conditional await behavior). The propagation chain is complete and functional.

@github-actions
Copy link

View all
File Benchmark Ops
bytes/hex-from.ts[0] parse hex using Number with NaN checking 49202.34 ±0.28% 89.23% slower
bytes/hex-from.ts[1] parse hex from char codes 457038.64 ±0.45% fastest ✅
bytes/hex-from.ts[2] parse hex from string nibbles 241342.55 ±0.45% 47.19% slower
math/count-bits-u32.ts[0] standard method 37862581.47 ±2.23% 59.97% slower
math/count-bits-u32.ts[1] magic 94579040.49 ±5.28% fastest ✅
math/count-bits-u64.ts[0] standard method 334293.04 ±0.72% 87.99% slower
math/count-bits-u64.ts[1] magic 2783785.69 ±0.46% fastest ✅
math/mul_overflow.ts[0] multiply and bring back to u32 98111822.29 ±4.69% fastest ✅
math/mul_overflow.ts[1] multiply and take modulus 96942820.44 ±5.21% 1.19% slower
math/switch.ts[0] switch 97099309.28 ±5.67% 5.39% slower
math/switch.ts[1] if 102634722.35 ±4.26% fastest ✅
hash/index.ts[0] hash with numeric representation 71.57 ±0.12% 28.62% slower
hash/index.ts[1] hash with string representation 36.04 ±0.13% 64.06% slower
hash/index.ts[2] hash with symbol representation 69.3 ±0.1% 30.89% slower
hash/index.ts[3] hash with uint8 representation 68.22 ±0.12% 31.96% slower
hash/index.ts[4] hash with packed representation 100.27 ±0.15% fastest ✅
hash/index.ts[5] hash with bigint representation 77.11 ±0.09% 23.1% slower
hash/index.ts[6] hash with uint32 representation 82.74 ±0.12% 17.48% slower
logger/index.ts[0] console.log with string concat 4780040.79 ±26.9% fastest ✅
logger/index.ts[1] console.log with args 1184939.77 ±81.37% 75.21% slower
collections/map-set.ts[0] 2 gets + conditional set 86021.42 ±0.42% fastest ✅
collections/map-set.ts[1] 1 get 1 set 49071.27 ±0.07% 42.95% slower
codec/bigint.decode.ts[0] decode custom 71777841.88 ±3.59% fastest ✅
codec/bigint.decode.ts[1] decode bigint 38147772.51 ±1.89% 46.85% slower
codec/bigint.compare.ts[0] compare custom 98459319.74 ±6.06% 1.05% slower
codec/bigint.compare.ts[1] compare bigint 99508934.17 ±5.32% fastest ✅
bytes/hex-to.ts[0] number toString + padding 83217.5 ±0.36% fastest ✅
bytes/hex-to.ts[1] manual 6739.24 ±0.53% 91.9% slower
math/add_one_overflow.ts[0] add and take modulus 102357784.81 ±3.13% fastest ✅
math/add_one_overflow.ts[1] condition before calculation 98422754.66 ±5.08% 3.84% slower
codec/decoding.ts[0] manual decode 7287702.4 ±0.8% 89.51% slower
codec/decoding.ts[1] int32array decode 69470744.8 ±2.75% fastest ✅
codec/decoding.ts[2] dataview decode 68190397.76 ±3.05% 1.84% slower
codec/encoding.ts[0] manual encode 919363.94 ±0.49% 14.02% slower
codec/encoding.ts[1] int32array encode 1069267.16 ±0.47% fastest ✅
codec/encoding.ts[2] dataview encode 1068427.45 ±0.45% 0.08% slower
codec/view_vs_object.ts[0] Get the first field from Decoded 182928.13 ±0.53% fastest ✅
codec/view_vs_object.ts[1] Get the first field from View 46134.57 ±0.51% 74.78% slower
codec/view_vs_object.ts[2] Get the first field as view from View 45860.89 ±0.49% 74.93% slower
codec/view_vs_object.ts[3] Get two fields from Decoded 181185.76 ±0.49% 0.95% slower
codec/view_vs_object.ts[4] Get two fields from View 36429.23 ±0.58% 80.09% slower
codec/view_vs_object.ts[5] Get two fields from materialized from View 74553.37 ±0.55% 59.24% slower
codec/view_vs_object.ts[6] Get two fields as views from View 36391.69 ±0.55% 80.11% slower
codec/view_vs_object.ts[7] Get only third field from Decoded 181090.27 ±0.5% 1% slower
codec/view_vs_object.ts[8] Get only third field from View 45225.51 ±0.53% 75.28% slower
codec/view_vs_object.ts[9] Get only third field as view from View 45303.69 ±0.55% 75.23% slower
codec/view_vs_collection.ts[0] Get first element from Decoded 12045.85 ±0.55% 56.25% slower
codec/view_vs_collection.ts[1] Get first element from View 27534.28 ±0.49% fastest ✅
codec/view_vs_collection.ts[2] Get 50th element from Decoded 12131.58 ±0.34% 55.94% slower
codec/view_vs_collection.ts[3] Get 50th element from View 14480.48 ±0.53% 47.41% slower
codec/view_vs_collection.ts[4] Get last element from Decoded 12105.85 ±0.18% 56.03% slower
codec/view_vs_collection.ts[5] Get last element from View 9948.7 ±0.27% 63.87% slower
collections/hash-dict-vs-blob-dict_get.ts[0] StringHashDictionary 1700.61 ±0.33% fastest ✅
collections/hash-dict-vs-blob-dict_get.ts[1] BlobDictionary(1) 1644.59 ±0.74% 3.29% slower
collections/hash-dict-vs-blob-dict_get.ts[2] BlobDictionary(2) 1619.97 ±0.25% 4.74% slower
collections/hash-dict-vs-blob-dict_get.ts[3] BlobDictionary(3) 1630.39 ±0.7% 4.13% slower
collections/hash-dict-vs-blob-dict_get.ts[4] BlobDictionary(4) 1645.57 ±0.77% 3.24% slower
collections/hash-dict-vs-blob-dict_get.ts[5] BlobDictionary(5) 1643.78 ±0.58% 3.34% slower
collections/hash-dict-vs-blob-dict_set.ts[0] StringHashDictionary 852.28 ±64.9% 45.46% slower
collections/hash-dict-vs-blob-dict_set.ts[1] BlobDictionary(1) 1451.87 ±2.07% 7.09% slower
collections/hash-dict-vs-blob-dict_set.ts[2] BlobDictionary(2) 1510.68 ±0.38% 3.33% slower
collections/hash-dict-vs-blob-dict_set.ts[3] BlobDictionary(3) 1482.53 ±0.34% 5.13% slower
collections/hash-dict-vs-blob-dict_set.ts[4] BlobDictionary(4) 777.38 ±92.85% 50.25% slower
collections/hash-dict-vs-blob-dict_set.ts[5] BlobDictionary(5) 1562.71 ±0.72% fastest ✅
collections/hash-dict-vs-blob-dict_delete.ts[0] StringHashDictionary 904.54 ±87.04% 21.97% slower
collections/hash-dict-vs-blob-dict_delete.ts[1] BlobDictionary(1) 1022.07 ±71.54% 11.83% slower
collections/hash-dict-vs-blob-dict_delete.ts[2] BlobDictionary(2) 1126.57 ±84.99% 2.82% slower
collections/hash-dict-vs-blob-dict_delete.ts[3] BlobDictionary(3) 1081.31 ±85.65% 6.72% slower
collections/hash-dict-vs-blob-dict_delete.ts[4] BlobDictionary(4) 1071.22 ±84.83% 7.59% slower
collections/hash-dict-vs-blob-dict_delete.ts[5] BlobDictionary(5) 1159.25 ±78.34% fastest ✅
collections/map_vs_sorted.ts[0] Map 136177.55 ±0.12% fastest ✅
collections/map_vs_sorted.ts[1] Map-array 46405.9 ±0.07% 65.92% slower
collections/map_vs_sorted.ts[2] Array 31583.81 ±2.42% 76.81% slower
collections/map_vs_sorted.ts[3] SortedArray 83028.76 ±0.11% 39.03% slower
bytes/bytes-to-number.ts[0] Conversion with bitops 3657.25 ±5.38% fastest ✅
bytes/bytes-to-number.ts[1] Conversion without bitops 3653.15 ±5.71% 0.11% slower
bytes/compare.ts[0] Comparing Uint32 bytes 9653.13 ±0.88% fastest ✅
bytes/compare.ts[1] Comparing raw bytes 9544.89 ±0.41% 1.12% slower
hash/blake2b.ts[0] our hasher 1.14 ±0.13% fastest ✅
hash/blake2b.ts[1] blake2b js 0.03 ±0.04% 97.37% slower
crypto/ed25519.ts[0] native crypto 3.75 ±21.85% fastest ✅
crypto/ed25519.ts[1] wasm lib 2.15 ±0.22% 42.67% slower
crypto/ed25519.ts[2] wasm lib batch 2.13 ±0.27% 43.2% slower

Benchmarks summary: 83/83 OK ✅

@tomusdrw tomusdrw added this pull request to the merge queue Dec 26, 2025
Merged via the queue into main with commit 5496f08 Dec 26, 2025
17 checks passed
@tomusdrw tomusdrw deleted the ms-sequential-accumulation-option branch December 26, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow for optional synchronous accumulation

4 participants