umka-lang icon indicating copy to clipboard operation
umka-lang copied to clipboard

Optimize map traversals

Open vtereshkov opened this issue 3 years ago • 0 comments

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.

vtereshkov avatar Jun 26 '22 15:06 vtereshkov