Took my own advice and removed an inappropriate use of polymorphism. There's a somewhat technical word EDATA which points other words to the ENTITY object for any object that implements the IENTITY interface. (Components implement it.) It was originally a method. Methods are slow. But SO many words called EDATA, crucial stuff like position. I changed EDATA to a code word; now all it does is fetch the address pointed to by THIS; the rule is, all IENTITY's have to store a pointer to an ENTITY in the first cell. Bind by memory layout instead of method table, get 35% speed gain.
Only Forth lets you break out of structure to make better use of resources so elegantly and painlessly. I think it's a preview into a future of less waste.
No comments:
Post a Comment