• Jeffrey Lee's avatar
    [308] SpriteOp 11 (merge sprite areas) gets slow for large numbers of sprites · 0b904557
    Jeffrey Lee authored
    Detail:
      s/vdu/vdugrafh - Rewrite MergeSpriteAreas so that memory movement is now O(N) instead of O(N^2). Checking for duplicate sprites is still slow (O(N^2) search), but this resolves the main performance bottleneck with the code.
      s/vdu/vdugrafg - Add a variant of SpriteCtrlBlk which skips the call to GetName; this helps MergeSpriteAreas for the common case of a dest area with lots of sprites and a source area with a handful of sprites (SpriteCtrlBlk is now called on the source area once per dest sprite, previously was called on the dest area once per source sprite).
    Admin:
      Tested on Raspberry Pi 1, merging Sovereign theme Sprites11 file with itself (2.2MB file, 358 sprites)
      Old code took 860cs, new code takes 18cs (15cs of which appears to be loading the second copy of the file, judging by *SLoad timings)
    
    
    Version 5.35, 4.79.2.321. Tagged as 'Kernel-5_35-4_79_2_321'
    0b904557
VersionASM 1.02 KB