Closed cboulay closed 12 years ago
I sped this up by removing one jQuery selector and reducing the scope of another. I also used some temporary variables to reduce code redundancy in if-else structures.
I think overall these changes were very small.
I also noticed that the more times I toggled players, the longer each toggle took. I guess this means there is a memory leak somewhere. By using the Timeline inspector I determined the most likely culprit is layoutmanager. Views are being discarded whenever a player leaves one side of the list. Maybe we need to do something more to get rid of these.
Close for now until the view leaks become a problem.
I just realized that every substitution tap was also causing the (not visible) player action buttons to re-render. That can be fixed.
It's better but still not fast enough. I might have to do it using direct view deletion/insertion instead of a general re-render. Another solution is to put ALL players in both on-field and off-field and toggle their display:hidden whenever they are tapped. Not very elegant but fast. Putting this on hold until other basic functionality is finished.
I tried out the playwithlv version on my Galaxy Nexus last night and saw that subbing players was very slow. Some of this might be due to the CSS, some of it might be due to my code. I'll try to find a faster solution in the near future.