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

Crippled performance, sometimes crashing on longer strings #18

Open
alariccole opened this issue Nov 13, 2014 · 6 comments
Open

Crippled performance, sometimes crashing on longer strings #18

alariccole opened this issue Nov 13, 2014 · 6 comments

Comments

@alariccole
Copy link

I've found that setting strings longer than about 50 characters crawls to a halt. Sometimes crashes. A simple fix would be to just not animate if the length is greater than a certain number. I attempted to do this by modifying the setter for the text variable, pausing the display link and setting super.text to the value if it was above a threshold. This sometimes works, but I think I'm missing something, as I still get issues with performance. Advice appreciated. Would love to use this in the next rev of Slated if I can get it reliable.

@lexrus
Copy link
Owner

lexrus commented Nov 17, 2014

Yes, this operation has a performance issue.

func >>(lhs: String, rhs: String) -> Array<LTCharacterDiffResult>

I must solve it before adding support for multiline. But I'm not good at algorithm.

@alariccole
Copy link
Author

I'm not particularly great at this kind of thing either. I think a simple, quick fix could be possible, in just not animating the diffs after a certain number. In real usage, this may actually be the preferred way to go, as it could look messy animating hundred of characters, even if we get the performance perfect. What do you think, is there a simple way to just cut it off after a certain length (20 or so characters perhaps)?

@eriktelepovsky
Copy link

It happens not only to long strings, but sometimes if many short strings appear in one controller as well.

@lexrus
Copy link
Owner

lexrus commented Feb 12, 2015

I guess the latest Swift 1.2 comes with a lot of performance enhancements. Please try Xcode 6.3 Beta.
https://github.com/lexrus/LTMorphingLabel/tree/swift1_2

@alariccole
Copy link
Author

I think the performance and crashing are just due to inherent design issues. I wish I understood the code enough to modify it. It's a really good effect when it works!

On Feb 12, 2015, at 12:19 AM, Lex Tang [email protected] wrote:

I guess the latest Swift 1.2 comes with a lot of performance enhancements. Please try Xcode 6.3 Beta.
https://github.com/lexrus/LTMorphingLabel/tree/swift1_2


Reply to this email directly or view it on GitHub.

@artworkad
Copy link

👍 UILabel is not designed to take long text. However what is long and not is defined by the use case of your App. Forcing a specific length would make this library unusable for many developers.

Instead I would make an effort to optimize the animation so that multiline and long text is not an issue for animation.

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

No branches or pull requests

4 participants