Skip to content

chore(json-schema): add JsonSchemaCoercer benchmarks - #1752

Merged
dinwwwh merged 1 commit into
middleapi:mainfrom
dinwwwh:claude/benches-json-schema-coercer-111f6c
Jul 30, 2026
Merged

chore(json-schema): add JsonSchemaCoercer benchmarks#1752
dinwwwh merged 1 commit into
middleapi:mainfrom
dinwwwh:claude/benches-json-schema-coercer-111f6c

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Jul 30, 2026

Copy link
Copy Markdown
Member

Adds CodSpeed benchmarks for JsonSchemaCoercer, so coercion performance is tracked alongside the existing serializer and handler benches. Each coercion-heavy scenario is paired with an already-typed variant, making the pass-through overhead visible separately from conversion cost.

Scenarios

  • Flat object from query params (integer/boolean/number/date string coercion) vs already typed.
  • Complex object mirroring the serializer benches' unit — date, bigint, set, map, url, regexp plus an anyOf union — as parsed JSON vs native instances.
  • 1000 complex objects in both forms for array-scale throughput.
  • Recursive $ref tree (156 nodes) exercising ref resolution and the cycle guard.

Notes

  • Schema fixtures use the same x-native-type shapes the real converters emit, taken from coercer.test.ts.
  • Fixtures were verified before benching: string payloads coerce to the expected native types, and already-typed payloads pass through by reference.

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orpc Ready Ready Preview Jul 30, 2026 6:25am

@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@1752

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@1752

@orpc/bun

npm i https://pkg.pr.new/@orpc/bun@1752

@orpc/client

npm i https://pkg.pr.new/@orpc/client@1752

@orpc/cloudflare

npm i https://pkg.pr.new/@orpc/cloudflare@1752

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@1752

@orpc/experimental-effect

npm i https://pkg.pr.new/@orpc/experimental-effect@1752

@orpc/evlog

npm i https://pkg.pr.new/@orpc/evlog@1752

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@1752

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@1752

@orpc/next

npm i https://pkg.pr.new/@orpc/next@1752

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@1752

@orpc/opentelemetry

npm i https://pkg.pr.new/@orpc/opentelemetry@1752

@orpc/pinia-colada

npm i https://pkg.pr.new/@orpc/pinia-colada@1752

@orpc/pino

npm i https://pkg.pr.new/@orpc/pino@1752

@orpc/publisher

npm i https://pkg.pr.new/@orpc/publisher@1752

@orpc/ratelimit

npm i https://pkg.pr.new/@orpc/ratelimit@1752

@orpc/server

npm i https://pkg.pr.new/@orpc/server@1752

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@1752

@orpc/swr

npm i https://pkg.pr.new/@orpc/swr@1752

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@1752

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@1752

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@1752

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@1752

commit: e896ed0

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 18 untouched benchmarks
🆕 7 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 1000 complex objects N/A 101.6 ms N/A
🆕 1000 complex objects already typed N/A 32.8 ms N/A
🆕 complex object already typed N/A 130.3 µs N/A
🆕 complex object with native types N/A 268.7 µs N/A
🆕 flat object already typed N/A 74.5 µs N/A
🆕 flat object from query params N/A 105.9 µs N/A
🆕 recursive $ref tree N/A 2.2 ms N/A

Comparing dinwwwh:claude/benches-json-schema-coercer-111f6c (e896ed0) with main (68f5955)

Open in CodSpeed

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — a single new benchmark file adding CodSpeed coverage for JsonSchemaCoercer.

  • Flat and complex object coercion (query-param strings → typed, plus native-type pass-through baselines)
  • Array-scale throughput with 1000 complex objects in both string and typed forms
  • Recursive $ref tree exercising $ref resolution on a 156-node depth-3/breadth-5 tree

The schemas match the production shapes from coercer.test.ts, every scenario pairs coercion cost with a pass-through baseline, and the file is self-contained.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@dinwwwh
dinwwwh merged commit df573c1 into middleapi:main Jul 30, 2026
11 checks passed
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.

1 participant