You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optimize Dependencies, Enhance Performance, and Improve Code Quality (#18)
* fix: handle optional stream value in chat request logging
* refactor: update application state and client initialization to accept direct configuration parameters
* refactor(chat): optimize security client usage by removing unnecessary cloning
Replace multiple clones of SecurityClient with direct mutation using with_user_ip method. This improves performance by avoiding redundant cloning while maintaining the same security checks functionality.
* perf(chat): optimize JSON parsing and serialization
This commit improves performance in the chat handler by optimizing JSON operations:
1. Eliminate double JSON parsing:
- Parse response body once into serde_json::Value
- Reuse the same parsed value for metrics logging and ChatResponse
- Reduces redundant parsing operations per request
2. Optimize response serialization:
- Replace serde_json::to_vec with serde_json::to_writer
- Write directly to Vec<u8> buffer to minimize allocations
- Streamline response construction flow
The changes reduce memory allocations and CPU usage, particularly under high load
with many concurrent requests. No behavioral changes, purely performance focused.
Impact:
- Reduces memory allocations in the response path
- Eliminates redundant JSON parsing
- More efficient serialization for masked content responses
- Cleaner error handling flow
* fix(logging): include version in server startup log message
* Bump version to 0.14.0 and update dependencies
- Updated axum from 0.7.4 to 0.8.4
- Updated tower-http from 0.5.1 to 0.6.6
- Updated reqwest from 0.11.24 to 0.12.23
- Updated serde from 1.0.197 to 1.0.219
- Updated serde_yaml from 0.9.31 to 0.9.34
- Updated uuid from 1.7.0 to 1.18.0
- Updated bytes from 1.5.0 to 1.10.1
- Updated http-body-util from 0.1.0 to 0.1.3
- Updated tracing-subscriber from 0.3.18 to 0.3.18 (no change)
- Updated futures-util from 0.3.30 to 0.3 (no change)
- Updated pin-project from 1.1.3 to 1.1.3 (no change)
* Optimize Rust application's library usage and improve code quality (#17)
* Initial plan
* Fix clippy warnings and optimize dependencies for better performance
Co-authored-by: lenoxys <3996456+lenoxys@users.noreply.github.com>
* Further optimize dependencies and improve memory efficiency patterns
Co-authored-by: lenoxys <3996456+lenoxys@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lenoxys <3996456+lenoxys@users.noreply.github.com>
* refactor(chat): simplify state handling and clone security client for IP configuration
* fix(chat): optimize response serialization and streamline streaming request handling
---------
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
0 commit comments