News for hackers. Stuff that matters.
Re:Ask HN: Is there a way to compress repeated JSON objects? by jimsmart on Monday July 04, 2016 @08:51AM (#12030395)
What is your goal?

If your goal is to reduce the amount of data that goes across the wire, just make sure you have gzip enabled on your server - the compression algorithm will take care of that for you.

Otherwise (if you are trying to reduce memory usage), you probably want to split them out, as say "sub-items", and refer to them by name - but there's no magic / hidden feature that will do that for you. Of course doing this will make both the client and the server code more complex.

In the majority of cases, I suspect most coders (myself included) would prefer the simpler code resulting from the former option - but it totally depends on your goal.

Have you actually measured/profiled the code/data in question? I ask because this kinda smells of being a premature optimisation (although obviously one cannot truly say, without more context).

There are no comments on this comment yet.