-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Conversation
With accurate layout scrolling will not be possible anyway.
When reusing the cell setting the text to nil and then to the correct value causes unnecessary work (measured) that we don’t have if we want to stay inside the frame budget.
by separating Date & Time part formatting into separate NSDateFormatter instances
If anything this hurts performance because janky scrolling is CPU bound (running out of the frame budget). shouldRasterize makes the GPU do less work by putting more work on the CPU with a forced rasterization step. This library doesn’t have any use for it currently.
This makes sure that we are not enabling dataDetectors in every cellAtIndexPath method call even if the library user wants to disable it. When creating it we set the default setting, then the user can do whatever he wants with it. Also there’s no reason to reset the dataDetectors to None on reuse, as the cell probably wants to use the previous settings. If not the library user should explicitly change it anyway.
Although not sure why string and attributedString representations of a timestamp should be different.
Combined with TTTAttributedLabel (which has way faster rendering and does data detection on a background thread) I managed to eliminate ALL jankiness. Seriouosly, it flies. I think it's a good call to switch to that for 8.0 |
Just created a PR for TTTAttributedLabel that will make it fly even more with data detectors. Just look at these number UITextView (1.662s) vs TTT (0.084s) |
thanks @galambalazs! wow - |
Good news: I managed to implement a version of TTTLabel which allows the native data detector actions to appear. Jesse: there are two quick demo projects and two videos in the smooth scrolling issue thread. i'm now 100% sure TTT is the way to go. I'll probably break this PR up to separate small ones and 1-2 may be merged so 7.x branch gets somewhat faster. But 8.0 is TTT all the way. |
I've taken some of these quick fixes and tried to apply to my project. I would really like to see this go somewhere.... |
Still waiting for @jessesquires to decide what's the plan for 8.0 The biggest change would come from switching to TTTAttributedLabel In that case only the date formatter is relevant from here. Maybe I'll add a separate PR for that's easy to merge. |
This reverts commit 846b9aa.
Hello everyone! I'm sorry to inform the community that I'm officially deprecating this project. 😢 Please read my blog post for details: http://www.jessesquires.com/blog/officially-deprecating-jsqmessagesviewcontroller/ Thus, I'm closing all issues and pull requests and making the necessary updates to formally deprecate the library. I'm sorry if this is unexpected or disappointing. Please know that this was an extremely difficult decision to make. I'd like to thank everyone here for contributing and making this project so great. It was a fun 4 years. 😊 Thanks for understanding, |
I made scrolling perfect on my iPhone 5s without removing auto-layout.
I commented on every commit.
Basically the changes in order of their importance:
textView.scrollEnabled=NO
causes scrolling problems for some reason, but it can be safely disabled because the layout takes care of thatNSDateFormatter
optimized by having separate Date & Time formatters and not changing the style of a single formatter all the time.setText=nil
upon cell reusetextView.awakeFromNib
instead ofcellForRowAtIndexPath
so library users can have better controlThe biggest bottleneck left seems to be
dataDetectors
as they heavily block the main thread.When testing this PR I advise you to disable them to see the smoothness achieved by these commits (without being affected by dataDetectors).
Maybe later I’ll come up with something to make that part faster as well.