Log In  

context

Earlier today, I learned that pressing ctrl+p while running a cart brings up a performance monitor (and something else I learned on accident: pressing ctrl+p in the commandline/text editor lets you use the tiny characters; this isn't documented in the pico-8 fandom wiki but is on pico-8's changelog in the manual.)

I booted up one of my carts and opened the performance monitor. (It runs at a smooth 60fps, it's not very complicated at all). For fun, I changed the cls(1) to print("\^c1"). To my great surprise, the performance monitor indicated that it did this ever so slightly quicker than cls(1). So I made a new cartridge (function _update60()for _=1,1000do print("\^c1") end) and it ran smoothly, never going over the virtual processor limit. I switched the print() to the respective cls() and it was almost 2 times more resource intensive, constantly over the virtual limit, and running at an extremely choppy ~1fps.

conclusion

I'm not sure how this would be useful unless you're calling cls() an awful lot of times, as it takes quite a few extra characters. Even with the minor improvement of using ? rather than print() is small, as you still need a newline on either side. If you really wanted to, you could just redefine cls() to simply be something like this:

function cls(a)a=a or 0
?"\^c"..split("0123456789abcdef","")[a+1]
end
P#89318 2021-03-21 21:02 ( Edited 2021-03-22 17:22)

interesting... very interesting
cls() is a significant part of cpu usage - worth a try 😜

P#89345 2021-03-22 10:17

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 13:33:52 | 0.005s | Q:8