+pico-8 cartridge // http://www.pico-8.com
+version 43
+__lua__
+-- perfgraph for pico-8
+-- simple performance graphs
+
+--[[
+
+this is a super simple way
+ to get a performance graph
+ into your pico-8 carts.
+
+1. #include perfgraph.p8:1.
+2. use 'p_start' and 'p_end'
+ around the code you need
+ to measure.
+3. call 'p_show'
+ to show a graph!
+ (the frame times will
+ reset after you
+ call this.)
+
+see full example on tab 2!
+
+]]
+
+-->8
+-- ⧗ implementation ⧗ --
+
+_p_perf={}
+
+function p_start(name,col)
+ local idx=_p_perf[name]
+ if(idx==nil)idx=#_p_perf+1
+ _p_perf[name]=idx
+ if(_p_perf[idx]==nil)_p_perf[idx]={name=name,col=col or idx%15+1}
+ local p=_p_perf[idx]
+ p.ct=p.ct or 0
+ p.st=stat(1)
+end
+
+function p_end(name)
+ assert(_p_perf[name])
+ local p=_p_perf[_p_perf[name]]
+ p.ct+=max(stat(1)-p.st,0)
+end
+
+function p_show(x,y,w,compact)
+ local cx,cy=camera()
+ clip()
+ fillp()
+
+ for idx,tp in ipairs(_p_perf) do
+ if tp.ct then
+ rectfill(x,y,x+w,y+4,0)
+ rectfill(x,y,x+tp.ct*w,y+4,tp.col)
+ ?"\^o0ff"..tp.name..":"..flr((tp.ct*100)+0.5).."%",x+w+4,y,7
+ y+=6
+ end
+ tp.ct=nil
+ end
+
+ camera(cx,cy)
+end
+
+-->8
+-- ♥ demo! ♥ --
+
+local m=10/100
+
+::l::
+
+p_start("frame")
+
+cls()
+
+f=10
+fl=true
+for i=0,-5000,-10 do
+ p_start("circle calculation")
+ local h=10
+ local z=i+time()*20
+ local x=cos(i/45)*8
+ local y=cos(i/100)*8
+ local hi=h*m*z
+ local c=7
+ if(fl)c=0
+ fl=not fl
+ p_end("circle calculation")
+
+ p_start("circle draw")
+ circfill(64+x,64+y,hi,c)
+ p_end("circle draw")
+end
+
+
+
+p_end("frame")
+
+p_show(1,1,32)
+
+flip()
+
+goto l
+
+__gfx__
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+__label__
+00007777777777777777777777777777777700000000000000000000000000000000000000000000000000000077777777777777777770000000000000000000
+02222222222222222222222200000000007707770777077707770777000007000777070700000000000000000000077777777777777777000000000000000000
+02222222222222222222222200000000007707000707070707770700007007000707000700000000000000000000000777777777777777700000000000000000
+02222222222222222222222200000000000007700770077707070770000007770777007000000000000000000000000007777777777777770000000000000000
+72222222222222222222222200000000000007000707070707070700007007070007070000000000000000000000000000077777777777777000000000000000
+72222222222222222222222200000000000007000707070707070777000007770007070700000000000000000000000000000777777777777700000000000000
+77777777777777777777777777777000000000000000000000000000000000000000000000000000000000000000000000000000000077770000000000000000
+73333330000000000000000000000000000000770777077700770700077700000077077707000077070707000777077707770077077000000770077707070000
+73333330000000000000000000000000000007000070070707000700070000000700070707000700070707000707007000700707070700700070070700070000
+73333330000000000000000000000000000007000070077007000700077000000700077707000700070707000777007000700707070700007070077700700000
+73333330000000000000000000000000000007000070070707000700070000000700070707000700070707000707007000700707070700700070070707000000
+73333330000000000000000000000000000000770777070700770777077707770077070707770077007707770707007007770770070700000777077707070000
+77777777777777777777000000000000000000000000000000000000000007770000000000000000000000000000000000000000000000070000000000000000
+74444444000000000000000000000000000000770777077700770707077707770770077707770707000007770770070700000000000000007777777770000000
+74444444000000000000000000000000000007000070070707000707070007770707070707070707007000070070000700000000000000000777777777000000
+74444444000000000000000000000000000007000070077007070707077077770707077007770707000007770070007007000000000000000077777777000000
+74444444000000000000000000000000000007000070070707000700070007770707070707070777007007000070070007770000000000000007777777700000
+74444444000000000000000000000000000000770777070700770777077707770777070707070777000007770777070707777700000000000000777777770000
+77777777777777000000000000000000000000000000000000000000000007770000000000000000077700000000000007777770000000000000077777770000
+77777777777770000000000000000000000000007777777777777777777777777777777777777777777777777777777777777777700000000000007777777000
+77777777777700000000000000000000000000077777777777777777777777777777777777777777777777777777777777777777770000000000000777777700
+77777777777000000000000000000000000007777777777777777777777777777777777777777777777777777777777777777777777700000000000077777700
+77777777777000000000000000000000000077777777777777777777770000000000000007777777777777777777777777777777777770000000000077777770
+77777777770000000000000000000000000777777777777777777000000000000000000000000077777777777777777777777777777777000000000007777770
+77777777700000000000000000000000077777777777777777000000000000000000000000000000077777777777777777777777777777770000000000777777
+77777777000000000000000000000000777777777777777000000000000000000000000000000000000077777777777777777777777777777000000000077777
+77777777000000000000000000000007777777777777700000000000000000000000000000000000000000777777777777777777777777777700000000077777
+77777770000000000000000000000077777777777770000000000000000000000000000000000000000000007777777777777777777777777770000000007777
+77777700000000000000000000000777777777777000000000000000000000000000000000000000000000000077777777777777777777777777000000000777
+77777700000000000000000000007777777777700000000000000000000000000000000000000000000000000000777777777777777777777777700000000777
+77777000000000000000000000077777777777000000000000777777777777700000000000000000000000000000077777777777777777777777770000000077
+77770000000000000000000000777777777700000000007777777777777777777770000000000000000000000000000777777777777777777777777000000007
+77770000000000000000000000777777777000000007777777777777777777777777770000000000000000000000000077777777777777777777777000000007
+77700000000000000000000007777777770000007777777777777777777777777777777770000000000000000000000007777777777777777777777700000000
+77700000000000000000000077777777000000777777777777777777777777777777777777700000000000000000000000077777777777777777777770000000
+77000000000000000000000777777770000077777777777777777777777777777777777777777000000000000000000000007777777777777777777777000000
+77000000000000000000000777777700000777777777777777777700000000000777777777777700000000000000000000000777777777777777777777000000
+70000000000000000000007777777000077777777777777777000000000000000000077777777777000000000000000000000077777777777777777777700000
+70000000000000000000077777770000777777777777777700000000000000000000000777777777700000000000000000000007777777777777777777770000
+00000000000000000000077777700007777777777777700000000000000000000000000000777777770000000000000000000000777777777777777777770000
+00000000000000000000777777700777777777777777000000000000000000000000000000077777777700000000000000000000777777777777777777777000
+00000000000000000007777777007777777777777700000000000000000000000077777777700777777770000000000000000000077777777777777777777700
+00000000000000000007777770077777777777777000000000000000000000077777777777777777777777000000000000000000007777777777777777777700
+00000000000000000077777700777777777777770000000000000000000007777777777777777777777777700000000000000000000777777777777777777770
+00000000000000000077777700777777777777700000000000000000000777777777777777777777777777700000000000000000000777777777777777777770
+00000000000000000777777007777777777777000000000000000000007777777777777777777777777777770000000000000000000077777777777777777777
+00000000000000000777770077777777777770000000000000000000077777777777777777777777777777777000000000000000000007777777777777777777
+00000000000000000777770777777777777700000000000000000000777777777770000000777777777777777700000000000000000007777777777777777777
+00000000000000007777700777777777777000000000000000000007777777777000000000007777777777777700000000000000000000777777777777777777
+00000000000000007777707777777777770000000000000000000077777777770000000000000777777777777770000000000000000000777777777777777777
+00000000000000077777077777777777770000000000000000000777777777700000000000000077777777777777000000000000000000077777777777777777
+00000000000000077777077777777777700000000000000000000777777777000000000000000007777777777777000000000000000000077777777777777777
+00000000000000077770777777777777000000000000000000007777777770000000000000000000777777777777700000000000000000007777777777777777
+00000000000000777770777777777777000000000000000000007777777770000000000000000000777777777777700000000000000000007777777777777777
+00000000000000777707777777777777000000000000000000077777777700000000000000000000077777777777770000000000000000000777777777777777
+00000000000000777707777777777770000000000000000000077777777700000000000000000000077777777777770000000000000000000777777777777777
+00000000000000777707777777777770000000000000000000077777777770000000000000000000077777777777770000000000000000000777777777777777
+00000000000007777077777777777700000000000000000000777777777700000000000000000000077777777777777000000000000000000077777777777777
+00000000000007777077777777777700000000000000000000777777777700000000000000000000077777777777777000000000000000000077777777777777
+00000000000007777077777777777700000000000000000000777777777700000000000000000000077777777777777000000000000000000077777777777777
+00000000000007770777777777777700000000000000000000777777777700000000000000000000077777777777777700000000000000000007777777777777
+00000000000007770777777777777000000000000000000000777777777770000000000000000000777777777777777700000000000000000007777777777777
+00000000000007770777777777777000000000000000000000777777777770000000000000000000777777777777777700000000000000000007777777777777
+00000000000077770777777777777000000000000000000000777777777777000000000000000007777777777777777700000000000000000007777777777777
+00000000000077777777777777777000000000000000000000777777777777700000000000000077777777777777777770000000000000000007777777777777
+00000000000077707777777777777000000000000000000000777777777777770000000000000777777777777777777770000000000000000000777777777777
+00000000000077707777777777777000000000000000000000077777777777777000000000007777777777777777777770000000000000000000777777777777
+00000000000077707777777777777000000000000000000000077777777777777770000000777777777777777777777770000000000000000000777777777777
+00000000000077707777777777777000000000000000000000077777777777777777777777777777777777777777777770000000000000000000777777777777
+00000000000077707777777777777000000000000000000000007777777777777777777777777777777777777077777770000000000000000000777777777777
+00000000000077707777777777777000000000000000000000007777777777777777777777777777777777777077777770000000000000000000777777777777
+00000000000077707777777777777000000000000000000000000777777777777777777777777777777777770077777770000000000000000000777777777777
+00000000000077707777777777777700000000000000000000000777777777777777777777777777777777770777777770000000000000000000777777777777
+00000000000077707777777777777700000000000000000000000077777777777777777777777777777777700777777770000000000000000000777777777777
+00000000000077707777777777777700000000000000000000000007777777777777777777777777777777000777777770000000000000000000777777777777
+00000000000077707777777777777700000000000000000000000000777777777777777777777777777770000777777770000000000000000000777777777777
+00000000000077707777777777777770000000000000000000000000077777777777777777777777777700007777777770000000000000000000777777777777
+00000000000077700777777777777770000000000000000000000000007777777777777777777777777000007777777700000000000000000000777777777777
+00000000000007700777777777777777000000000000000000000000000777777777777777777777770000077777777700000000000000000000777777777777
+00000000000007700777777777777777000000000000000000000000000007777777777777777777000000077777777700000000000000000000777777777777
+00000000000007770777777777777777000000000000000000000000000000077777777777777700000000077777777700000000000000000007777777777777
+00000000000007770077777777777777700000000000000000000000000000000077777777700000000000777777777000000000000000000007777777777777
+00000000000007770077777777777777770000000000000000000000000000000000000000000000000007777777777000000000000000000007777777777777
+00000000000007770077777777777777770000000000000000000000000000000000000000000000000007777777777000000000000000000007777777777777
+00000000000000770007777777777777777000000000000000000000000000000000000000000000000077777777770000000000000000000007777777777777
+00000000000000777007777777777777777700000000000000000000000000000000000000000000000777777777770000000000000000000077777777777777
+00000000000000777007777777777777777770000000000000000000000000000000000000000000007777777777770000000000000000000077777777777777
+00000000000000777000777777777777777777000000000000000000000000000000000000000000077777777777700000000000000000000077777777777777
+00000000000000077700777777777777777777700000000000000000000000000000000000000000777777777777700000000000000000000777777777777777
+00000000000000077700077777777777777777770000000000000000000000000000000000000007777777777777000000000000000000000777777777777777
+00000000000000077700077777777777777777777000000000000000000000000000000000000077777777777777000000000000000000000777777777777777
+00000000000000007770007777777777777777777700000000000000000000000000000000000777777777777770000000000000000000007777777777777777
+00000000000000007770000777777777777777777777000000000000000000000000000000077777777777777700000000000000000000007777777777777777
+00000000000000000777000777777777777777777777700000000000000000000000000000777777777777777700000000000000000000077777777777777777
+70000000000000000777000077777777777777777777777700000000000000000000000777777777777777777000000000000000000000077777777777777777
+70000000000000000777700007777777777777777777777777000000000000000000077777777777777777770000000000000000000000777777777777777777
+77000000000000000077700000777777777777777777777777777700000000000777777777777777777777700000000000000000000000777777777777777770
+77000000000000000077770000777777777777777777777777777777777777777777777777777777777777700000000000000000000007777777777777777770
+77700000000000000007770000077777777777777777777777777777777777777777777777777777777777000000000000000000000007777777777777777700
+77700000000000000007777000007777777777777777777777777777777777777777777777777777777770000000000000000000000077777777777777777700
+77770000000000000000777700000777777777777777777777777777777777777777777777777777777700000000000000000000000777777777777777777000
+77770000000000000000077700000007777777777777777777777777777777777777777777777777770000000000000000000000000777777777777777770000
+77777000000000000000077770000000777777777777777777777777777777777777777777777777700000000000000000000000007777777777777777770000
+77777700000000000000007777000000077777777777777777777777777777777777777777777777000000000000000000000000077777777777777777700000
+77777700000000000000000777700000000777777777777777777777777777777777777777777700000000000000000000000000777777777777777777000000
+77777770000000000000000777700000000077777777777777777777777777777777777777777000000000000000000000000000777777777777777777000000
+77777777000000000000000077770000000000777777777777777777777777777777777777700000000000000000000000000007777777777777777770000000
+77777777000000000000000007777000000000007777777777777777777777777777777770000000000000000000000000000077777777777777777700000000
+77777777700000000000000000777700000000000007777777777777777777777777770000000000000000000000000000000777777777777777777000000000
+77777777770000000000000000777770000000000000007777777777777777777770000000000000000000000000000000007777777777777777777000000000
+77777777777000000000000000077777000000000000000000777777777777700000000000000000000000000000000000077777777777777777770000000000
+77777777777000000000000000007777770000000000000000000000000000000000000000000000000000000000000007777777777777777777700000000000
+77777777777700000000000000000777777000000000000000000000000000000000000000000000000000000000000077777777777777777777000000000000
+77777777777770000000000000000077777700000000000000000000000000000000000000000000000000000000000777777777777777777770000000000000
+77777777777777000000000000000007777777000000000000000000000000000000000000000000000000000000077777777777777777777700000000000000
+77777777777777700000000000000000777777700000000000000000000000000000000000000000000000000000777777777777777777777000000000000000
+77777777777777770000000000000000077777777000000000000000000000000000000000000000000000000077777777777777777777770000000000000000
+77777777777777777000000000000000000777777770000000000000000000000000000000000000000000007777777777777777777777000000000000000000
+77777777777777777700000000000000000077777777700000000000000000000000000000000000000000777777777777777777777770000000000000000007
+07777777777777777770000000000000000007777777777000000000000000000000000000000000000077777777777777777777777700000000000000000077
+00777777777777777777000000000000000000077777777777000000000000000000000000000000077777777777777777777777770000000000000000000777
+00077777777777777777770000000000000000007777777777777000000000000000000000000077777777777777777777777777700007000000000000007777
+00007777777777777777777000000000000000000077777777777777770000000000000007777777777777777777777777777770000070000000000000077777
+00000777777777777777777700000000000000000007777777777777777777777777777777777777777777777777777777777700000700000000000000777777
+00000007777777777777777777000000000000000000077777777777777777777777777777777777777777777777777777770000070000000000000007777777
+70000000777777777777777777700000000000000000000777777777777777777777777777777777777777777777777777000000700000000000000077777777
+77000000077777777777777777777000000000000000000000777777777777777777777777777777777777777777777000000077000000000000000777777777
+77700000000777777777777777777700000000000000000000007777777777777777777777777777777777777777700000000700000000000000007777777777
+