SamCoVT / TaliForth2

A Subroutine Threaded Code (STC) ANSI-like Forth for the 65c02
Other
29 stars 7 forks source link

Faster compilation with compile_nt_comma #118

Closed patricksurry closed 3 months ago

patricksurry commented 4 months ago

compile, calls int>name ( xt -- nt ) it to get status flags, but that's slow since it searches the dictionary.

Since all the current callers of compile, are doing name>int ( nt -- xt ) beforehand we can save a bunch of cycles (amounting to about 5% of the full test suite) by providing a new entrypoint that acts on the nt instead.

Could even expose as a word like compile-nt, if you think that makes sense?

SamCoVT commented 4 months ago

This looks pretty reasonable. Exposing a compile-nt, word into the forth wordlist might not be a terrible idea, but I'm not sure how much it would get used from forth. The search words like FIND return XTs, and getting the NT from an XT already takes another trip through the dictionary again. The assembly level optimization looks good, though.

patricksurry commented 4 months ago

ok, let's leave it as is for now (not exposed in forth)