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

Optimized file generation in WavefrontWriter. #167

Merged
merged 5 commits into from Jan 15, 2023

Conversation

MeltyPlayer
Copy link
Contributor

Switches the WavefrontWriter from generating bytes for each file upfront and then saving them to generating bytes lazily via delegates.

Specifically, the old process involved writing to a StringBuilder, saving that to a MemoryStream, and then saving those bytes through File.WriteAllBytes(); now, the new process just writes directly to the FileStream via the Stream interface.

This results in less memory being allocated in total, and allocations being freed up sooner so that they can be reclaimed by the garbage collector.

…that it's more robust.

Set up platforms for x86 and x64.
…ass to avoid OutOfMemory exceptions in 32-bit mode, which fixes some of the existing tests.
…ow many objects are created and stored in memory at once.
…irectly to the output FileStream rather than first to a MemoryStream and then copying.
…thod so that it's more robust."

This reverts commit 4d6b732.
@MeltyPlayer MeltyPlayer changed the title Obj Optimized file generation in WavefrontWriter. Jan 15, 2023
@vpenades vpenades merged commit 8a7da18 into vpenades:master Jan 15, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants