K
K
kocherman2012-12-06 19:09:11
JavaScript
kocherman, 2012-12-06 19:09:11

Serializing a large array of numbers with compression?

Good day, dear habravchane!
Again, out of desperation, I turn to the community.
web application. It is necessary to transfer a fairly large array of numbers from the server to the browser. The array itself is different for each session, and is formed on the server side.
Keeping an array for each session on the server side, and loading the values ​​as needed, would be expensive for memory on the server. In addition, you do not want to unnecessarily send cookies to the browser. Therefore, it was decided to transfer the array immediately with the page, so that the browser would process its data.
The serialized array in json takes about 85kb. But this is just with test data. It is necessary on the server to somehow compress the array of numbers into some string. And on the client side, unpack this line.
The server side is written in nodejs. Therefore, any compression / decompression algorithm in javascript will do.
Has anyone seen something similar on the net or faced similar problems?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
avalak, 2012-12-06
@avalak

gzip + local/session storage

@
@ksurent, 2012-12-06
_

Convert to BER and compress with bzip, for example.

W
wa_Nadoo, 2012-12-18
@wa_Nadoo

Have a look at the BSON data format bsonspec.org/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question