Skip to content

修复HTTP服务Windows性能异常和中文路径相关Bug #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2025

Conversation

House-Men
Copy link
Contributor

Windows HTTP服务注意了 #559 合并之后的版本性能是有异常的,我也是最近压测无意中发现,分析源码排查老半天才发现原因在codecvt编码转换

修复Windows defaultStaticHandler性能错误
Windows版本从合并 #559 之后HTTP服务默认静态处理因编码转换严重影响服务性能。
为了方便解决Windows高性能宽字符函数编码转换,在hstring.h增加了hv::wchar_to_utf8和hv::utf8_to_wchar函数
顺便修复http服务遇到中文路径时stat不可用导致文件缓存逻辑故障 和 http服务目录索引中文乱码问题

6693a712a6bbd5a9d8adcffc6f99c178

fix http chinese name file cache bug
support http index directory view chinese name
add high-performance wchar_to_utf8 and utf8_to_wchar
@House-Men
Copy link
Contributor Author

House-Men commented Mar 27, 2025

解决因 codecvt 导致的性能异常问题后发现对无效文件请求还有性能提升空间
对access,stat,open循环访问无效文件做了性能实验后结论如下
windows系统:access性能最佳,相比stat差距微小,相比open性能差距巨大
linux系统:stat性能最佳,相比access和open都差距巨大
所以在open之前通过stat不仅高效返回无效文件请求,还能减少open之后重复的stat调用。
最后压测结果性能总算回归巅峰😀

image

@ithewei ithewei merged commit 70f0a8f into ithewei:master Mar 31, 2025
6 checks passed
@House-Men House-Men deleted the patch-0 branch April 1, 2025 06:30
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.

2 participants