Menu

Box to save memory
📰
0

Box to save memory

Hacker News·Hacker News·about 1 month ago
#morKI6WO
Reading 0:00
15s threshold

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" : { "type" : "structure" , "members" : { "OrganizationId" : { "target" : "com.amazonaws.iam#OrganizationIdType" , "traits" : { "smithy.api#documentation" : "<p>The unique identifier (ID) of an organization.</p>" } }, "EnabledFeatures" : { "target" : "com.amazonaws.iam#FeaturesListType" , "traits" : { "smithy.api#documentation" : "<p>The features you have enabled for centralized root access.</p>" } } }, "traits" : { "smithy.api#output" : {} } }, As is common in Rust, my program uses the very convenient serde .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More