Using SwiftForth, I am currently looking at methods for measuring the time it takes for a word to be executed. I am using the words 'counter' and then 'timer' in the form:
counter insert_word_here timer
This immediately outputs the time in microseconds that it takes to run the word. Is there a way I can prevent this integer from being outputted immediately, so that I can store it in the stack?
timer
in SwiftForth is implemented something likeSimply define a word without the
u.
and the elapsed time in milliseconds is left on the stack.I don't have SwiftForth, but timer was defined as an example on the page I found. I think this should work, but I can't test it.