KickC ability - info
zbyti opened this issue · 5 comments
@KarolS please look at this post in your free time: https://atariage.com/forums/topic/312816-kickc-benchmark-tests-cf-mad-pascal-wip/?do=findComment&comment=4668844
This is an optimization Millfork is capable of doing, and usually it does it without hitch. Are you familiar with these: https://github.com/KarolS/millfork-benchmarks
Cool, I'll try to write flames in Millfork and see if compiler generates indirect indexed or indexed only :] THX
Bubble Sort comparison:
//Millfork -Xr
for t,253,downto,0{
for i,0,to,253{
n1 = sorttable[i]
n2 = sorttable[i+1]
if n1>n2 {
sorttable[i] = n2
sorttable[i+1] = n1
}
}
}
2025: A9 FE LDA #$FE
2027: 85 83 STA $83 ;VNTP+1
2029: C6 83 DEC $83 ;VNTP+1
202B: A9 00 LDA #$00
202D: 85 80 STA $80 ;LOMEM
202F: A4 80 LDY $80 ;LOMEM
2031: B9 00 21 LDA $2100,Y
2034: 85 81 STA $81 ;LOMEM+1
2036: B9 01 21 LDA $2101,Y
2039: 85 82 STA $82 ;VNTP
203B: C5 81 CMP $81 ;LOMEM+1
203D: B0 0C BCS $204B
203F: A5 82 LDA $82 ;VNTP
2041: A4 80 LDY $80 ;LOMEM
2043: 99 00 21 STA $2100,Y
2046: A5 81 LDA $81 ;LOMEM+1
2048: 99 01 21 STA $2101,Y
204B: A5 80 LDA $80 ;LOMEM
204D: C9 FD CMP #$FD
204F: F0 05 BEQ $2056
2051: E6 80 INC $80 ;LOMEM
2053: 4C 2F 20 JMP $202F
2056: A5 83 LDA $83 ;VNTP+1
2058: D0 CF BNE $2029
//KickC
for (char loop: 253..0) {
for (char j: 0..253) {
char n1 = sortTable[j];
char n2 = sortTable[j+1];
if (n1 > n2) {
sortTable[j] = n2;
sortTable[j+1] = n1;
}
}
}
2A41: A2 00 LDX #$00
2A43: BC 00 2F LDY $2F00,X
2A46: BD 01 2F LDA $2F01,X
2A49: 84 FF STY $FF ;FPTR2+1
2A4B: C5 FF CMP $FF ;FPTR2+1
2A4D: B0 07 BCS $2A56
2A4F: 9D 00 2F STA $2F00,X
2A52: 98 TYA
2A53: 9D 01 2F STA $2F01,X
2A56: E8 INX
2A57: E0 FE CPX #$FE
2A59: D0 E8 BNE $2A43
2A5B: C6 88 DEC $88 ;STMTAB
2A5D: A9 FF LDA #$FF
2A5F: C5 88 CMP $88 ;STMTAB
2A61: D0 DE BNE $2A41
2A63: 60 RTS
I'll be back with testing with the next Millfork release.
I worked a bit on optimization in the new version and 0.3.24 should be a bit faster.
Cool, as soon as I finish writing the tutorial: how to write a game on A8. I will write the Millfork suite to compare it with KickC and Mad Pascal.