What is the fastest infinite loop in TI-84+ Basic?

天大地大妈咪最大 提交于 2019-12-14 02:16:34

问题


Since there are technically 4 types of loops (for, while, repeat, and goto/lbl), which one is the fastest to use "infinitely"? Here is what I mean:

while 1
End

repeat 0
End

lbl 1
goTo 1

for(n, 1, [number large enough to function as practically infinite]
End

Which of these is the fastest, or is there an even faster one?


回答1:


In terms of both size and speed, the repeat and while loops are the fastest.

While 1 and Repeat 0 are both 2 bytes, while End is 1. In terms of space, they are both 4 bytes.

In terms of speed, the same is true. Just try making a simple program that loops to infinity and time it.

TL;DR: While 1: End and Repeat 0: End




回答2:


Technically the fastest is:

AsmPrgm
18FE

which has to be run as an assembly program.

This is using Z80 assembly to create an infinite (unstoppable except by the reset button) loop. The code is run directly by the processor, so the OS doesn't need to spend time interpreting it.



来源:https://stackoverflow.com/questions/41028809/what-is-the-fastest-infinite-loop-in-ti-84-basic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!