Add CompressAsync and DecompressAsync
brandonsturgeon opened this issue · 0 comments
brandonsturgeon commented
Details
LZMA compression is very good, but it's also very slow.
Adding other algorithms seems like a pain, but it would be very nice if we had an asynchronous option.
Usage Example
local fileData = file.Read( "massiveFile.json", "DATA" )
util.CompressAsync( fileData, function( status/success, data )
if not success or status ~= COMPRESS_SUCCESS then
error( "Unable to compress data!" )
end
uploadData( data )
end )
Benchmark
Running util.Compress
on a 35.77MB
JSON Blob took 6.912s
on a pretty powerful (4.8+ GHz) server. That means the server would have been fully locked up for almost 7 full seconds which is very not cool.
I know this isn't a great thing to do in Gmod, but it would sure be nice if we could without taking such a significant hit to performance.