Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is sending data as application/octet-stream any more efficient than sending it as a JSON-encoded byte array?

I have a web application that allows a client to request several image thumbnails at once. The response is currently sent as a JSON-encoded list of objects where each object includes the (encoded) image data. (I'm using JSON.NET; it looks like it's encoding the image data as base64 strings).

If I change my application such that the image data is sent separately from the JSON object, as "binary" (application/octet-stream) content, will this be more efficient?

Or put more simply, is application/octet stream a more compact encoding than base64?

Also, how does this differ from image/jpeg?

like image 237
Gary McGill Avatar asked Sep 09 '12 00:09

Gary McGill


1 Answers

OK, so application/octet-stream is essentially binary, which is - of course - more efficient than base64. Something like 30% more efficient in terms of space, and removes the need to encode/decode.

like image 107
Gary McGill Avatar answered Nov 15 '22 04:11

Gary McGill