Theme lag when auto changing images

I recently started using a kustom theme, and i've noticed when i add the timer function; $df(s)/10%21$ my theme begins to lag and spike a bit... Is there any particular reason as to why this happens? or any type of work around?

That function will make the image change every 10 seconds, depending on the size of the image this might be an heavy task and might make things stutter a bit, 3.27 will be much more fluid in terms of rendering but if this is heavy on CPU it will still use quite a lot of battery