Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up meeting model transmission using compression #5

Open
tomgoddard opened this issue Oct 10, 2023 · 2 comments
Open

Speed up meeting model transmission using compression #5

tomgoddard opened this issue Oct 10, 2023 · 2 comments

Comments

@tomgoddard
Copy link
Contributor

Opening a new 900,000 triangle model (22 Mbytes) in a 3-person meeting on a slow wifi connection such as a cell-phone hotspot or old wifi 4 router, or a congested newer router can take up to about 20 seconds to transmit to the two participants. On a wifi 6 router it is currently taking about 3 seconds.

We could gzip compress with the standard .Net gzip compressor the gltf data. In a test on a 22 Mbyte colored EM map surface it compressed to half size 11 Mbytes. If the compression is fast this should result in a factor of 2 speed-up transmitting the data to participants in a meeting. I don't know how fast the C# gzip compression and decompression is. Would need to test that.

@tomgoddard
Copy link
Contributor Author

The C# GZipStream compressing 22 Mbytes to 11 Mbytes in memory took 2.3 seconds on the Quest 2 using the default "optimal" compression level (balancing speed and size). Using the GZipStream "fastest" or "nocompression" or "optimal" compression level took the same 2.3 seconds and resulted in exactly the same compressed size so apparently Unity GZipStream ignores the compression level on the Quest 2. Preallocating the memory stream for the gzipped data did not speed it up. The decompression times was always 0.16 seconds.

So unfortunately the compression time is longer than the wifi transmission time on wifi 6 for a 2-person meeting.

I didn't see any other built-in .NET compression options although their are third-party Unity assets that compress. Unity uses LZ4 to compress its builds but I don't see runtime access for doing in-memory data compressions.

@tomgoddard
Copy link
Contributor Author

Here is a github repository for LZ4 compression/decompression in Unity

https://github.com/91Act/lz4-unity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant