📰 2026-04-27 08:30 更新
🔸 Box to Save Memory in Rust / 用于在Rust中保存内存的框
🔗 Box to Save Memory in Rust
🔥 35 points
原文:
I saved 475 MB out of the 895 MB used by a real-world Rust program by changing the layout of some structs and the way I was deserializing JSON files. The real use case My program deserializes all the JSON files of https://github.com/awslabs/aws-sdk-rust/tree/main/aws-models into “Smithy Shape” structs. Those files contain thousands of structures similar to this one: “com.amazonaws.iam#EnableOrganizationsRootSessionsResponse”: {
译文:
通过更改一些结构的布局和我反序列化JSON文件的方式,我从真实世界的Rust程序使用的895 MB中节省了475 MB。实际用例我的程序将https://github.com/awslabs/aws-sdk-rust/tree/main/aws-models的所有JSON文件反序列化为“Smithy Shape”结构。这些文件包含数千个类似于此的结构: “com.amazonaws.iam#EnableOrganizationsRootSessionsResponse”: {
自动更新 · 正文抓取 · 双语翻译