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

VirtuallyRotatedTextWithTerminator: avoid building RotatedTextWithTerminator #51

Open
antonioaversa opened this issue Jun 14, 2022 · 0 comments
Labels
improvement Improvement of an existing feature

Comments

@antonioaversa
Copy link
Owner

Improvement: avoid building RotatedTextWithTerminator and have VirtuallyRotatedTextWithTerminator access directly to the underlying TextWithTerminator.

Currently the construction of a VirtuallyRotatedTextWithTerminator instance requires wrapping the underlying TextWithTerminator into a RotatedTextWithTerminator: c.p. the following excerpt from

new(new(text, text.Terminator, false), rotation);

    public static VirtuallyRotatedTextWithTerminator ToVirtuallyRotated(this TextWithTerminator text, int rotation) =>
        new(new(text, text.Terminator, false), rotation);

Why: on large input (strings of hundreds of MB), a RotatedTextWithTerminator instance has to be built for each "virtual rotation" of the input, i.e. as many instances of this object are created as chars in the input. This leads to a high memory usage, and possibly to OutOfMemoryException.

@antonioaversa antonioaversa added the improvement Improvement of an existing feature label Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant