I mentioned last week I was expecting a checkin that would transform the performance of Sparkle’s timeline. The issue was simple: we create a row in the timeline for every element in the scene, then create more rows for each property that is animated. We also create tabs for all the states, and each row is itself fairly complex. The real problem is that we just keep on adding rows. With one of our standard test scenes, you could get 16000 Framework elements into the timeline. Switching to and from scenes rebuilds the entire timeline…making it very slow.
Kenny noticed we were drawing the time markers with elements, and switched to rendering them, saving 160 elements (they were there even when not visible…). But the real work was to virtualize the timeline so no matter how many rows it contains we only create elements for those that are visible. You can do this using Avalon’s VirtualizingStackPanel, though it required more work than that to match the structure of our timeline. In any case, the results are now in and prominent in our daily perf tests (high-end machine):
“Large Scene – Load Project” went from 12.2 sec to 4 sec
“Large Scene – Switch from One Scene to Another” 8.3 sec to 379 ms
“Large Scene – Switch from Scene to Code Behind” 7.5 sec to 287 ms