umka-lang
umka-lang copied to clipboard
Optimize map traversals
The for...in loop, when applied to maps, now calls the keys() function, then iterates over the key array and requests the map item for each key individually. The repr() function is implemented in a similar fashion. Thus, the map tree is traversed twice: first when constructing the key array, then for accessing the map items. In theory, a single traversal is enough to get both the keys and the items.