Open
Conversation
…first here doesn't help
…he will auto clear during low memory)
Owner
|
Sorry for the terrible delay on getting to this. I've been using RNTextStatistics for an idea that involves large bodies of text. However it can be super slow. I'm going to pull in this request to my project and play w/ it to see how a) memory is used and b) if there is a noticeable speed increase. Really appreciate the work here! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will cache several frequently used calculations and syllable counts of words.
Syllable counts for words are stored globally in an NSCache which will auto-purge should memory become an issue.
Cached values (clean text, letter/word/sentence counts, and average syllables) are only cached once accessed so memory of strings where these values aren't used shouldn't be impacted. They're cached with associated objects so they'll automatically be released when the string is.
Cached values are ignored for mutable strings.
P.S. I totally understand if you don't want to merge this as it can/will increase memory usage. I did, however, get a very noticeable speed boost; esp. when displaying multiple statistics about a block of text.