Skip to content
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

eframe: don't prettify stored values #902

Merged
merged 1 commit into from
Nov 28, 2021

Conversation

AlexChaplinBraz
Copy link
Contributor

What ultimately ends up stored into a file is the
HashMap<String, String>, which when prettified only nets three
(depending on the settings) lines of "string": "long prettified
string that's really hard to read because of the extra indentation and
literal \n characters that are all just on one single line".

Not prettifying the values in the first place makes it somewhat easier
to read and also saves a bit of space.

Closes https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE.

What ultimately ends up stored into a file is the
HashMap<String, String>, which when prettified only nets three
(depending on the settings) lines of "string": "long prettified
string that's really hard to read because of the extra indentation and
literal \n characters that are all just on one single line".

Not prettifying the values in the first place makes it somewhat easier
to read and also saves a bit of space.
@AlexChaplinBraz
Copy link
Contributor Author

The amount of space saved is actually quite significant. I tried getting rid of all the \n plus adjacent whitespace with sed on the save file of what I'm working on and it went from 346.6 KiB to 224.4 KiB. That's a third of the size wasted right there. I reckon that's important if targetting the web, right?

The program I'm working on is for native, but I'm expecting the save file to be a few megabytes at least (growing larger the more stuff the user adds). Not sure if that's too big, but I'll see. I can work around it, but would prefer not to if it won't affect performance anyway.

@emilk
Copy link
Owner

emilk commented Nov 28, 2021

We should also consider switching to a binary alternative such as MsgPack

@emilk emilk changed the title Don't prettify stored values eframe: don't prettify stored values Nov 28, 2021
@emilk emilk merged commit 224d4d6 into emilk:master Nov 28, 2021
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