purec icon indicating copy to clipboard operation
purec copied to clipboard

Create structs for type classes

Open felixSchl opened this issue 5 years ago • 1 comments

The current dictionary-based approach has poor performance because the dictionaries are frequently allocated and released, meaning that strings (keys) are frequently allocated and released as well. Considering that the dictionary is completely known a priori we might as well emit matching structs or use some purs_any_t ** and access them by some known pointer offset by key.

felixSchl avatar Nov 08 '18 23:11 felixSchl

This comment still holds true in part, however, top-level thunks are now cached and only evaluated once during the program's runtime. Another idea I had to perhaps squeeze out a bit more performance improvements without relying on upstream support for this feature is to pre-hash the keys into the dictionary for generated code.

felixSchl avatar Feb 19 '21 23:02 felixSchl