Skip to content

Optimize fast-float exponential presentation path#4700

Open
Neomelt wants to merge 1 commit intofmtlib:masterfrom
Neomelt:fix/4518-default-fp-presentation-opt
Open

Optimize fast-float exponential presentation path#4700
Neomelt wants to merge 1 commit intofmtlib:masterfrom
Neomelt:fix/4518-default-fp-presentation-opt

Conversation

@Neomelt
Copy link

@Neomelt Neomelt commented Mar 5, 2026

Summary

  • Optimize the default fast-float exponential presentation path by avoiding the extra write-and-swap step in the pointer fast path.
  • Reuse write_significand directly in that path to reduce redundant memory operations.

Rationale

Issue: #4518

This change targets the post-Dragonbox presentation stage (not Dragonbox core generation), which is where #4518 suggests optimization opportunities.

Validation

  • format-test: pass
  • format-impl-test: pass
  • quick perf sanity check shows positive direction locally (non-rigorous sanity benchmark):
    • before: ~355.1 ms
    • after: ~332.5 ms

Notes

  • Small, behavior-preserving change.
  • No formatting semantics intentionally changed.

@Neomelt
Copy link
Author

Neomelt commented Mar 5, 2026

I explored a second follow-up optimization in the same area and ran additional local microbenchmarks, but the gain was not stable across data patterns, so I intentionally did not include that change in this PR.

Keeping this PR focused on the small behavior-preserving improvement only.

If maintainers prefer a specific benchmark setup for #4518 (e.g. format-benchmark scenarios), I can run and post those numbers as a follow-up.

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