Skip to content

Conversation

@fvaleye
Copy link

@fvaleye fvaleye commented Oct 30, 2025

Description

Replace formatter-based string construction with manual formatting using String::with_capacity and write! across chrono ToSql implementations. This reduces allocations and formatter overhead on hot paths.

Local benchmark with my laptop

Type Before (format) After (write + capacity) Speedup Improvement
NaiveDate::to_sql 112.9 ns 53.6 ns 2.11x 111% faster
NaiveTime::to_sql 174.1 ns 119.0 ns 1.46x 46% faster
NaiveDateTime::to_sql 229.1 ns 154.0 ns 1.49x 49% faster

…o for better performance

Signed-off-by: Florian Valeye <[email protected]>
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