Skip to content

test(form): benchmark nested FormData-to-JSON conversion - #11280

Open
icecold009 wants to merge 3 commits into
axios:v1.xfrom
icecold009:codex/axios-10982-form-json-benchmark
Open

icecold009 wants to merge 3 commits into
axios:v1.xfrom
icecold009:codex/axios-10982-form-json-benchmark

Conversation

@icecold009

@icecold009 icecold009 commented Oct 3, 2026 •

Copy link
Copy Markdown

Summary

Adds a reproducible benchmark for the flat, indexed, and deeply nested FormData-to-JSON workloads requested in #10982. This tooling-only contribution makes no runtime optimization or performance claim.

Linked issue

Closes #10982.

Changes

Validation

Run locally on Windows x64 with Node.js v24.12.0:

  • node scripts/benchmarks/form-data-to-json.js — passed; all three workloads completed with output and input-preservation assertions.
  • npx.cmd --no-install prettier --check scripts/benchmarks/form-data-to-json.js scripts/benchmarks/README.md PRE_RELEASE_CHANGELOG.md — passed.
  • git diff --check — passed for the local patch.
  • The existing formDataToJSON unit suite passed earlier on this branch (15 tests); it was not rerun for this tooling/docs/changelog amendment.
  • Full runtime lint/build/browser/package/type suites do not apply: no runtime source, dependency, adapter, package metadata, build configuration, or declaration changed.
  • For latest commit 365a2ccfb3fec41e77a88d2e6f9083dab50cadc7, CI, Bundle Size, and GitHub Actions Security Analysis with zizmor are action_required awaiting maintainer approval. GitHub lists 17 required checks as pending; no hosted CI pass is claimed. Automated review checks are separate.

Compatibility and documentation

Patch-level Maintenance change. No public API or runtime behavior changes. The benchmark requires native FormData (Node.js 20.19+). PRE_RELEASE_DOCS.md, index.d.ts, index.d.cts, and type tests are N/A because public behavior and types are unchanged.

Checklist

  • Scope, base branch, and issue rationale checked
  • Maintenance changelog entry updated
  • Benchmark output and input-preservation assertions cover all workloads; runtime regression tests are N/A
  • Applicable local checks completed and recorded above
  • Release docs and ESM/CJS types/tests updated where needed (N/A: no public changes)
  • Semver impact stated; no breaking change
  • Final diff reviewed for scope, security, generated files, and debug leftovers
  • Latest hosted workflow status recorded separately from review bots

AI assistance: OpenAI Codex assisted with implementation and validation. The current head commit is unsigned, and GitHub blocks merging until commits have verified signatures and a code-owner approval is recorded. The ai-assisted label also still needs a maintainer: the GitHub connector returned 403, and no label control is available in the author browser view.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Adds a benchmark script for form conversion performance.

No outstanding findings block merging.

Summary

Adds a standalone benchmark for flat, indexed, and deeply nested FormData-to-JSON conversion, with correctness checks, timing output, usage notes, and a prerelease Maintenance entry. The changelog links both the issue and this PR.

Reviews (3) · Last reviewed commit: "style(form): normalize benchmark file en..."

Comment thread PRE_RELEASE_CHANGELOG.md Resolved

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/benchmarks/README.md Resolved
Comment thread scripts/benchmarks/form-data-to-json.js Resolved

@Cyberhet Cyberhet 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.

Thanks for putting this benchmark together! It's super useful to have a reproducible way to track formDataToJSON performance as we iterate on the library.

A couple of small observations:

  1. Warm-up: As noted by the automated review, a single execution of formDataToJSON(input) might not be enough to trigger V8's JIT compilation and optimize the function. It might be better to run an untimed warm-up loop of conversions iterations before starting the timed samples.
  2. README Output Table: In scripts/benchmarks/README.md, the expected output for indexed_100 and deep_100 describes an array of 100 objects, but actually formDataToJSON nests these inside an object according to the root key (e.g., { items: [...] } and { root: { level: { items: [...] } } } respectively). Updating the table would make it exactly match the assertions.

Overall, this is a great addition!

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread PRE_RELEASE_CHANGELOG.md Resolved

@jasonsaayman jasonsaayman 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.

PR #11280 - test(form): benchmark nested FormData-to-JSON conversion

Repo: axios/axios Author: @icecold009 Base: v1.x Files: 3 **+123/-0
CI: Unavailable: no checks returned; no build/test workflow result is present in this snapshot. Mergeability: conflicting. Reviewed head: 365a2ccfb3fec41e77a88d2e6f9083dab50cadc7.

Repo Profile

Axios is an npm JavaScript HTTP client for browsers and Node, with XHR/Fetch/HTTP adapters, default and named exports, interceptors, headers/errors, and paired ESM/CJS declarations. The target uses Vitest plus browser and package/module tests; v1 packaging covers older Node CJS runtimes as well as current ESM, Bun and Deno. Contributions preserve transport/security boundaries, add regression coverage and prerelease records, and defer unreleased user docs to PRE_RELEASE_DOCS.md. This review uses the actual target-branch guidance and files, not the separate local v0 checkout.

Verdict

Request changes — No concrete source defect found in this review; the missing latest-head validation and merge conflicts prevent merge approval.
Posted as a comment review for the validation/integration hold; no formal code-change request is implied beyond the specific items below.

Change Explanation And User Impact

This adds a formDataToJSON benchmark covering flat, indexed and deep inputs. It warms each case, measures multiple samples and verifies complete output outside the timed section. The practical effect is a repeatable maintainer workflow for spotting parser cost changes without mixing assertions into the timing. No runtime code or supported API changes. Its results should be interpreted within the printed Node/platform and fixture sizes, not as a universal throughput claim.

Validation scope: source/diff and regression-test review. Examples explicitly marked executed used isolated source snapshots on Node 24.18.0 with the workspace dependency installation; these were focused checks, not a clean install, full CI matrix, or full test-suite run. Author-reported test results were not treated as independently executed.

Competing PRs

Search: axios/axios open PRs, including drafts; full open-list scan plus formDataToJSON in:title,body, 11295 in:title,body, credential redaction in:title,body. Complementary searches were run across related APIs/issues; no query reached the 100-result cap and no search failed. The five explicitly excluded PRs were not reviewed or modified in this batch.

#11296 and #11328 address the same length-slot failure. #11296 uses a narrower guard and has both insertion orders plus browser HTML-form coverage, so it is preferred. #11278 preserves empty field names; #11280 supplies a benchmark; #11299 strengthens hardening tests. Those are complementary. Newly opened #11353 uses the same targeted guard as #11296, with fewer regressions and no prerelease entry; its combined length/nested/dotted cases are covered by #11296.

Preferred PR: No competing implementation supersedes this PR; continue it independently.

Unique contributions: The submitted regression cases protect this specific boundary; preserve them independently of adjacent fixes.

Action: No duplicate closure: the candidates are complementary or no equivalent solution was found.

Project Fit

North star: Reliable HTTP transport and configuration across supported JavaScript environments, without embedding application-specific policy.

Benefits: Provides repeatable parser performance measurements with correctness assertions.

Tradeoffs: Synthetic fixtures improve repeatability but do not model every user form or memory profile.

Fit: Strong — The underlying problem belongs in the transport, serializer, declarations or their maintenance tests.

Adversarial Review

Strongest objection: Synthetic fixtures improve repeatability but do not model every user form or memory profile. Latest-head integration evidence is still needed.

Abuse/failure modes checked: Inspected fixture construction, warm-up, sample/statistic calculation, output validation and environment metadata. Did not run the performance benchmark.

Result: No concrete source defect established in the examined cases; validation and integration limits remain below.

Disposition

Continue
Address the specific blockers below; no unrelated scope or complementary PR should be closed.

Semver

patch — Corrects existing behavior or strengthens internal tooling/tests without adding a public API.

Breaking Changes

None: this is test/tooling-only work or a declaration widening for already-supported runtime behavior.

Documentation

PRE_RELEASE_CHANGELOG.md records the change. No new API reference or migration is required for this scoped correction; keep the release description consistent with the behavior and limits above.

Performance And Regression Risk

Hot path touched: No shipped runtime change.

Performance concern: The benchmark measures a hot parser but does not change it. Timing evidence was not produced by this review.

Regression risk: low — the changed boundary needs regression and integration coverage, particularly after any rebase.

Evidence requested: Reproducible benchmark evidence as described above and the required integration checks.

Blocking Issues

  • Latest-head build/test validation is unavailable in the returned GitHub checks. Run or attach the repository build, relevant regression suite and required package/type/browser checks before merge; review/security bots alone do not establish that they pass. This is a validation hold, not an invented source defect.
  • GitHub reports merge conflicts with the current target. Resolve them and re-run relevant checks; the reviewed source snapshot is not a tested merge result.

Non-Blocking Suggestions

  • Capture before/after runs with the same runtime and machine whenever using this benchmark to justify a parser optimization.

Looks Good

  • Inspected fixture construction, warm-up, sample/statistic calculation, output validation and environment metadata. Did not run the performance benchmark.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted This PR was created with or in conjunction with AI commit::tests The PR is related to tests v1x Version 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benchmark idea: FormData-to-JSON conversion with nested keys

3 participants