• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
High CPU during automatic scrolling
#1
Hi,

I am just starting to get acquainted with MS, but I have quite the relevant issue to report which keeps me from using the app fully.

It seems that automatic scrolling (vertical scrolling using continuous scrolling for a fixed time) will cause excessively high CPU usage. My fairly new iPad Air (M1) gets warm after some 10-15 seconds and after a full song of three minutes it is hot to the touch (like when playing a game). This has an obvious effect on battery life. I have only tested with ChordPro files, so I can't say if it affects Sheets/PDF as well.

Please let me know if I can help troubleshoot further. The app version is current (3.8.44). iOS is current (17.6.1)
Reply
#2
I'll look into it to see if there adjustments that can be made to lower the CPU usage. The smoother the scroll is, the higher the CPU because it's going to force invalidation/redrawing as the components are moved on the screen. So one thing I could consider is making the scrolling a little less smooth by forcing a minimum time between invalidations while scrolling is active, which means the page will shift more pixels at once between each redraw.

Mike
Reply
#3
Thanks for your quick reply, sounds reasonable! Redrawing once per second f e would be fine with me personally, since it is usually a very slow scroll. But I assume the overhead for rendering the chordpro files must be obnoxiously huge for some reason? I also notice that resizing/pinching chord pro files is somewhat sluggish so I guess it is related. Is it possible to do a less taxing variant of rendering whereby the full .cho is rendered offscreen in a buffer and then copy/blit the relevant part of the bitmap onscreen?
Reply
#4
Once a chord pro file is rendered, there is just a cached image per page. The images are not re-rendered unless you change the font size or some other property that requires a re-render (pinch zooming changes the font size). So this cost of redrawing the page should be no higher than using a PDF or image file, as the pages of the chord pro file are still just cached in memory as images. One thing I should mention is that, with text/chord pro files, if I processed every small delta with a pinch zoom and re-rendered the file each time, that would overwhelm the cpu, so I instead only process deltas that cross a certain threshold, so that's why there isn't a smooth zoom effect with chord pro files. Also, due to the dynamic nature of chord pro files where the entire layout of every page changes if you change the font size or other text display settings, I can't cache much that would speed up the rendering. PDFs are faster to process in this regard, as all of the page sizes are fixed and they usually just have images stored in the pages, or vector graphics.

Mike
Reply
#5
Thanks again, and for explaining the innards. But then I am at a loss as to why scrolling about the cached image would consume so much power as to cause the device to even remotely heat up. But I agree that reducing draw rate will alleviate the issue linearly. Thanks for discussing and being so open!
Reply
#6
There was definitely an issue - my code was updating the layout as fast as possible, which isn't an issue in other frameworks as they will only update the layout at certain intervals. On iOS, it will happily update the layout as fast the CPU can handle it in a loop, which is why the CPU is hitting 100% while automatic scrolling. I have fixed this for the next update so that it will use around 10% CPU while automatic scrolling is active, instead of 100%. That should fix the battery drain issues you were seeing.

Thanks,
Mike
Reply
#7
Thanks Mike! Happy to hear it and thanks for looking into!
Reply




Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2024 MyBB Group.