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

TiledSharp streamed tile deflation extremely slow for large maps on my machine. #582

Open
bryanedds opened this issue Aug 3, 2023 · 1 comment
Labels
enhancement performance issues or potential issues relating to performance

Comments

@bryanedds
Copy link
Owner

Not sure if this is an anti-pattern where decodedStream.Data is a DeflateStream, but this TiledSharp code runs extremely slow in certain cases -

            if (encoding == "base64")
            {
                var decodedStream = new TmxBase64Data(xData);
                var stream = decodedStream.Data;

                using (var br = new BinaryReader(stream))
                    for (int j = 0; j < height; j++)
                        for (int i = 0; i < width; i++)
                            tiles[i + j * width] = new TmxLayerTile(br.ReadUInt32());
            }

Is the issue that deflation happens at every br.ReadUInt32 call? Definitely seems like some redundant processing is happening here...

Interestingly, this code runs okay on my old machine...

The workaround is to disable compression in such maps like so -

image

@bryanedds
Copy link
Owner Author

bryanedds commented Oct 26, 2023

Should we just fork TiledSharp and fix this behavior ourselves? Nu users will quite possibly encounter this themselves and not know (nor care) it's a TiledSharp issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement performance issues or potential issues relating to performance
Projects
None yet
Development

No branches or pull requests

1 participant