CFC-Servers / gm_express

An unlimited, out-of-band, bi-directional networking library for Garry's Mod
https://gmod.express
GNU General Public License v3.0
68 stars 4 forks source link

As-needed Compression #32

Closed brandonsturgeon closed 1 year ago

brandonsturgeon commented 1 year ago

util.Compress is super slow with sizable payloads.

I believe that skipping compression is better in most cases, the only exceptions being:

  1. Clients with really slow internet struggling with slightly larger uploads (max upload size is 22mb at the moment, so I don't think this is too big of a concern)
  2. When the data would legitimately be too big to send without compression

To address that, this PR only util.Compresss the data if it would otherwise exceed the size limit, and does another check to verify that the compressed data is also within the size constraints.

Note: This PR uses some experimental GLuaTest syntax that I hope to get merged in the next couple of days, so this PR is blocked until then.