I'll start it off with a random program, "Mul(TI)task v1.2" by David Matthews. His original code (616-byte program file):
My improved version, using mostly the simplest of optimization tricks. The main slowdown in the program is the redrawing of the time on every..single..loop, which is easy to fix (although I did not). Thoughts?
BASIC Code wrote:
::"MULTI TASK CALC
:0→A
:ClrHome
:0→C
:"(^-1)sin(cos(tan(^²E()/log(789*ln(456-√(123+10^0.‾"→Str8
:" "→Str7
:" "→Str9
:While getKey≠22
:If K=15
:Then
:0→C
:" "→Str9
:0→A
:ClrHome
:End
:"AM"→Str0
:getTime→L1
:If L1(1)≥13
:Then
:L1(1)-12→L1(1)
:"PM"→Str0
:End
:
:Output(3,2,Str9
:Output(6,1," "
:Output(1,3," "
:Output(1,6," "
:Output(1,9," "
:Output(1,2,L1(1)
:Output(1,4,":"
:Output(1,5,L1(2)
:Output(1,7,"."
:Output(1,8,L1(3
:Output(1,12,Str0
:Output(6,1,A
:getKey→K
:If C=1 and K=45
:Then
:"0"→Str9
:0→A
:ClrHome
:End
:
:If K=11
:Then
:0→A
:1→C
:">"→Str9
:End
:
:If C=1 and K=23 and length(Str9)>1
:Then
:sub(Str9,1,length(Str9)-1)→Str9
:ClrHome
:End
:If C=1 and K=105
:Then
:expr(sub(Str9,2,length(Str9)-1))→A
:">"→Str9
:ClrHome
:End
:
:If C=1 and K>60 and K<105
:Then
:"BEGIN MULTI TASKIN'
:K-50→N
:N→θ
:If N≥10
:Then
:N/10→S
:int(S)→S
:5*S→U
:N-U→θ
:End
:Str9+sub(Str8,θ,1)→Str9
:End
:End
:ClrHome
:Stop
Generated by SourceCoder, © 2005 Cemetech
:0→A
:ClrHome
:0→C
:"(^-1)sin(cos(tan(^²E()/log(789*ln(456-√(123+10^0.‾"→Str8
:" "→Str7
:" "→Str9
:While getKey≠22
:If K=15
:Then
:0→C
:" "→Str9
:0→A
:ClrHome
:End
:"AM"→Str0
:getTime→L1
:If L1(1)≥13
:Then
:L1(1)-12→L1(1)
:"PM"→Str0
:End
:
:Output(3,2,Str9
:Output(6,1," "
:Output(1,3," "
:Output(1,6," "
:Output(1,9," "
:Output(1,2,L1(1)
:Output(1,4,":"
:Output(1,5,L1(2)
:Output(1,7,"."
:Output(1,8,L1(3
:Output(1,12,Str0
:Output(6,1,A
:getKey→K
:If C=1 and K=45
:Then
:"0"→Str9
:0→A
:ClrHome
:End
:
:If K=11
:Then
:0→A
:1→C
:">"→Str9
:End
:
:If C=1 and K=23 and length(Str9)>1
:Then
:sub(Str9,1,length(Str9)-1)→Str9
:ClrHome
:End
:If C=1 and K=105
:Then
:expr(sub(Str9,2,length(Str9)-1))→A
:">"→Str9
:ClrHome
:End
:
:If C=1 and K>60 and K<105
:Then
:"BEGIN MULTI TASKIN'
:K-50→N
:N→θ
:If N≥10
:Then
:N/10→S
:int(S)→S
:5*S→U
:N-U→θ
:End
:Str9+sub(Str8,θ,1)→Str9
:End
:End
:ClrHome
:Stop
Generated by SourceCoder, © 2005 Cemetech
My improved version, using mostly the simplest of optimization tricks. The main slowdown in the program is the redrawing of the time on every..single..loop, which is easy to fix (although I did not). Thoughts?
BASIC Code wrote:
::"MULTI TASK CALC
:DelVar ADelVar CClrHome
:"(^-1)sin(cos(tan(^²E()/log(789*ln(456-√(123+10^0.‾"→Str8
:" →Str7
:" →Str9
:Delvar KRepeat K=22
:If K=15
:Then
:DelVar CDelVar A" →Str9
:ClrHome
:End
:"AM→Str0
:getTime→L1
:If 13<=L1(1
:Then
:L1(1)-12→L1(1
:"PM→Str0
:End
:
:Output(3,2,Str9
:Output(6,1,"
:Output(1,3," : :
:Output(1,2,L1(1
:Output(1,5,L1(2
:Output(1,8,L1(3
:Output(1,12,Str0
:Output(6,1,A
:getKey→K
:If C=1 and K=45
:Then
:"0→Str9
:DelVar AClrHome
:End
:
:If K=11
:Then
:Delvar A1→C
:">→Str9
:End
:
:If C=1 and K=23 and 1<length(Str9
:Then
:sub(Str9,1,length(Str9)-1→Str9
:ClrHome
:End
:If C=1 and K=105
:Then
:expr(sub(Str9,2,length(Str9)-1→A
:">→Str9
:ClrHome
:End
:
:If C=1 and K>60 and K<105
:Then
:K-50→N
:N→θ
:If N≥10
:Then
:N/10→S
:int(S→S
:5S→U
:N-U→θ
:End
:Str9+sub(Str8,θ,1→Str9
:End
:End
:ClrHome
Generated by SourceCoder, © 2005 Cemetech
:DelVar ADelVar CClrHome
:"(^-1)sin(cos(tan(^²E()/log(789*ln(456-√(123+10^0.‾"→Str8
:" →Str7
:" →Str9
:Delvar KRepeat K=22
:If K=15
:Then
:DelVar CDelVar A" →Str9
:ClrHome
:End
:"AM→Str0
:getTime→L1
:If 13<=L1(1
:Then
:L1(1)-12→L1(1
:"PM→Str0
:End
:
:Output(3,2,Str9
:Output(6,1,"
:Output(1,3," : :
:Output(1,2,L1(1
:Output(1,5,L1(2
:Output(1,8,L1(3
:Output(1,12,Str0
:Output(6,1,A
:getKey→K
:If C=1 and K=45
:Then
:"0→Str9
:DelVar AClrHome
:End
:
:If K=11
:Then
:Delvar A1→C
:">→Str9
:End
:
:If C=1 and K=23 and 1<length(Str9
:Then
:sub(Str9,1,length(Str9)-1→Str9
:ClrHome
:End
:If C=1 and K=105
:Then
:expr(sub(Str9,2,length(Str9)-1→A
:">→Str9
:ClrHome
:End
:
:If C=1 and K>60 and K<105
:Then
:K-50→N
:N→θ
:If N≥10
:Then
:N/10→S
:int(S→S
:5S→U
:N-U→θ
:End
:Str9+sub(Str8,θ,1→Str9
:End
:End
:ClrHome
Generated by SourceCoder, © 2005 Cemetech