Skip to content

Expose and performance optimize validation - #75

Merged
blakeembrey merged 1 commit into
masterfrom
be/expose-validation
Sep 10, 2026
Merged

blakeembrey merged 1 commit into
masterfrom
be/expose-validation

Conversation

@blakeembrey

Copy link
Copy Markdown
Member

Optimize the validation functions. It's a good amount more code, but now that we're on ESM if format isn't used it can be dropped from the output of the package size. Added size-limit to check the overall bundle size too.

Perf before (using format as the proxy):

 ✓ src/index.bench.ts > format 5086ms
     name                                      hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · basic                          16,270,663.28  0.0000  0.1058  0.0001  0.0001  0.0001  0.0001  0.0002  ±0.12%  8135332
   · simple parameters               2,482,510.90  0.0003  0.2038  0.0004  0.0004  0.0005  0.0005  0.0010  ±0.15%  1241256
   · quoted and escaped parameters   1,686,373.42  0.0005  0.2309  0.0006  0.0006  0.0007  0.0007  0.0012  ±0.24%   843187

After:

 ✓ src/index.bench.ts > format 5878ms
     name                                      hz     min     max    mean     p75     p99    p995    p999     rme   samples
   · basic                          20,233,039.07  0.0000  0.1885  0.0000  0.0000  0.0001  0.0001  0.0002  ±0.12%  10116520
   · simple parameters               3,574,345.35  0.0002  0.4722  0.0003  0.0003  0.0004  0.0004  0.0009  ±0.26%   1787173
   · quoted and escaped parameters   3,094,882.46  0.0002  0.3335  0.0003  0.0003  0.0004  0.0005  0.0009  ±0.51%   1547442

Reasonably significant and worth the trade-off IMO.

@blakeembrey
blakeembrey requested review from a team, Phillip9587 and bjohansebas August 21, 2026 17:36
@codecov

codecov Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (cb52296) to head (55f5446).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #75   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          155       190   +35     
  Branches        40        48    +8     
=========================================
+ Hits           155       190   +35     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bjohansebas bjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

Comment thread src/index.ts
@Phillip9587

Copy link
Copy Markdown
Contributor

I left a comment but just saw that the parse()function also does not validate if the input is a string and only fails in skipOWS().

Comment thread README.md Outdated
@blakeembrey
blakeembrey force-pushed the be/expose-validation branch from ac757ca to f3e6ff1 Compare August 24, 2026 20:42
@blakeembrey
blakeembrey changed the base branch from master to be/parse-perf August 24, 2026 20:42
@blakeembrey
blakeembrey changed the base branch from be/parse-perf to master September 10, 2026 22:58
@blakeembrey
blakeembrey merged commit 8a42ded into master Sep 10, 2026
8 checks passed
@blakeembrey
blakeembrey deleted the be/expose-validation branch September 10, 2026 23:02
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