fabric-meta icon indicating copy to clipboard operation
fabric-meta copied to clipboard

Pretty printing

Open Bixilon opened this issue 3 years ago • 4 comments

Why pretty printing?

( public static Gson GSON = new GsonBuilder().setPrettyPrinting().create();

I mean this is an api...that gets used by probably bots and not humans. It increases traffic and file sizes (for them, who download it). Also it affects performance.

Has this an intention?

I'd think about an extra parameter like ?pretty=true that is false by default.

Bixilon avatar May 23 '22 21:05 Bixilon

Yes, its easier to read, the overhead for having it is basically nothing. Having it as an option would lower the cache hit raito so would be worse imo.

modmuss50 avatar May 23 '22 21:05 modmuss50

It's not nothing, that json is ~550kb and minified around 380. That makes a difference.

But I agree, it is far more readable.

Yes, it would make caching worse, but probably not that much... Probably most people (can) use it minified.

Bixilon avatar May 24 '22 09:05 Bixilon

Prettifying is not needed. The bandwidth overhead is not nothing, and having the user do so when prettifying is easy.

On Visual Studio Code, it's a single keybind, and on browsers such as Firefox, a prettified view is generated automatically when receiving JSON.

EliteMasterEric avatar Mar 18 '23 04:03 EliteMasterEric

Chromium-based browsers will pretty print API responses in version 113

No need

IMB11 avatar Mar 18 '23 12:03 IMB11