Skip to content

feat: add comprehensive criterion benchmarks across all core crates#64

Merged
mohamedmansour merged 2 commits intomainfrom
feat/benches
Mar 5, 2026
Merged

feat: add comprehensive criterion benchmarks across all core crates#64
mohamedmansour merged 2 commits intomainfrom
feat/benches

Conversation

@mohamedmansour
Copy link
Copy Markdown
Contributor

Add realistic, real-world benchmark suites for all performance-critical crates in the workspace, modeled after actual WebUI template patterns from the example apps.

Parser benchmarks (webui-parser):

  • Add 4 realistic template builders: todo-app root page, shadow-DOM component, text-heavy article, and mixed-directive dashboard.
  • Add parser_realistic and parser_text_vs_directive benchmark groups.
  • Keep all 5 existing synthetic benchmark groups for regression tracking.

Handler benchmarks (webui-handler):

  • Add handler_loop_scaling: vary array size from 10 to 2000 items.
  • Add handler_condition_variety: identifier, predicate, negation, and compound AND/OR conditions with true/false/mixed state.
  • Add handler_nested_components: 3-level component hierarchy (root, app, item) with 50 loop iterations.
  • Add handler_state_depth: flat through 5-level nested state lookups.

Protocol benchmarks (webui-protocol):

  • Add medium protocol (6-fragment todo-app equivalent).
  • Add parametric large protocol generator (dashboard with N panels).
  • Add protocol_size_sweep: serialize/deserialize at 5, 15, 30, 50 panel counts to measure scaling.

Expression benchmarks (webui-expressions) — NEW:

  • Benchmark evaluate() across identifiers, predicates (string equality, numeric comparison, variable-vs-variable), compound AND/OR with short-circuit evaluation, negation, and realistic patterns (admin check, auth guard, item state check).

State benchmarks (webui-state) — NEW:

  • Benchmark find_value_by_dotted_path across path depths (1-8 levels), value types (string/number/boolean/array/object clone cost), .length pseudo-property, missing-path early exit, large object (100 keys) lookup, and loop simulation (100-item batch lookups).

Process management refactor (xtask):

  • Extract child-process lifecycle logic from dev.rs into a dedicated process.rs module with cross-platform support.
  • Add graceful shutdown via SIGTERM (Unix) and CTRL_BREAK_EVENT (Windows) with a timed fallback to a forced stop.
  • Spawn children in their own process groups for clean signalling.
  • Replace Printer struct with direct console::style() calls, aligning with upstream terminal styling changes from chore: auto-install dev tools and unify terminal styling #63.

Xtask bench command:

  • Add bench subcommand supporting parser, handler, protocol, expressions, state, and all targets.

Dependencies:

  • Add criterion as a workspace dev-dependency for expressions and state.
  • Add libc as a unix-only dependency for xtask (process groups).

Add realistic, real-world benchmark suites for all performance-critical
crates in the workspace, modeled after actual WebUI template patterns
from the example apps.

Parser benchmarks (webui-parser):
- Add 4 realistic template builders: todo-app root page, shadow-DOM
  component, text-heavy article, and mixed-directive dashboard.
- Add parser_realistic and parser_text_vs_directive benchmark groups.
- Keep all 5 existing synthetic benchmark groups for regression tracking.

Handler benchmarks (webui-handler):
- Add handler_loop_scaling: vary array size from 10 to 2000 items.
- Add handler_condition_variety: identifier, predicate, negation, and
  compound AND/OR conditions with true/false/mixed state.
- Add handler_nested_components: 3-level component hierarchy (root, app,
  item) with 50 loop iterations.
- Add handler_state_depth: flat through 5-level nested state lookups.

Protocol benchmarks (webui-protocol):
- Add medium protocol (6-fragment todo-app equivalent).
- Add parametric large protocol generator (dashboard with N panels).
- Add protocol_size_sweep: serialize/deserialize at 5, 15, 30, 50
  panel counts to measure scaling.

Expression benchmarks (webui-expressions) — NEW:
- Benchmark evaluate() across identifiers, predicates (string equality,
  numeric comparison, variable-vs-variable), compound AND/OR with
  short-circuit evaluation, negation, and realistic patterns (admin
  check, auth guard, item state check).

State benchmarks (webui-state) — NEW:
- Benchmark find_value_by_dotted_path across path depths (1-8 levels),
  value types (string/number/boolean/array/object clone cost), .length
  pseudo-property, missing-path early exit, large object (100 keys)
  lookup, and loop simulation (100-item batch lookups).

Process management refactor (xtask):
- Extract child-process lifecycle logic from dev.rs into a dedicated
  process.rs module with cross-platform support.
- Add graceful shutdown via SIGTERM (Unix) and CTRL_BREAK_EVENT (Windows)
  with a timed fallback to a forced stop.
- Spawn children in their own process groups for clean signalling.
- Replace Printer struct with direct console::style() calls, aligning
  with upstream terminal styling changes from #63.

Xtask bench command:
- Add bench subcommand supporting parser, handler, protocol,
  expressions, state, and all targets.

Dependencies:
- Add criterion as a workspace dev-dependency for expressions and state.
- Add libc as a unix-only dependency for xtask (process groups).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mohamedmansour mohamedmansour requested review from a team, akroshg and janechu March 4, 2026 23:49
@akroshg
Copy link
Copy Markdown
Contributor

akroshg commented Mar 5, 2026

How these benchmark run? do you need to update the documentation?

@mohamedmansour
Copy link
Copy Markdown
Contributor Author

How these benchmark run? do you need to update the documentation?

Yes, sorry, updated! You can use cargo bench -p webui-parser or you can us the task runner cargo xtask bench parser

@mohamedmansour mohamedmansour merged commit 03ef3c8 into main Mar 5, 2026
10 checks passed
@mohamedmansour mohamedmansour deleted the feat/benches branch March 5, 2026 06:38
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.

3 participants