Open patricksurry opened 1 month ago
One of the differences is that -TRAILING
is an ANS standard word, while the others are Tali specific. The standard specifically mentions spaces, which are elsewhare defined as BL
and the value 0x20
.
https://forth-standard.org/standard/string/MinusTRAILING
ah, that makes sense. so I'll switch -TRAILING back to only check for spaces. Does it make sense for -LEADING to behave in a similar same (only strip spaces specifcally) or should it continue to strip other whitespace as well?
I agree that -TRAILING
should use only spaces, but I'm fine with the other words skipping any whitespace and I think your changes look fine for those words.
Saves about 50 bytes overall. Simplifies CLEAVE (faster, smaller and avoids input manipulation). Shortens -LEADING/TRAILING: this slows it down a little after removing some inlining, but also because I switched to the shared
jsr is_whitespace
instead of the specificcmp #AscSP
. I'm not sure if that was intentional but seemed like it should be symmetric with LEADING and CLEAVE?The overall test cycles increase somewhat because -TRAILING is used in various tests, but I imagine in practice the CLEAVE improvement might be more important? Equally I could just undo the -TRAILING changes.
Cycle counts with simple test:
*337 with
cmp #AscSp
instead ofjsr is_whitespace
.