Enumerations are implemented inefficiently
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ikarus Scheme |
Fix Committed
|
Medium
|
Abdulaziz Ghuloum |
Bug Description
Enumerations are currently implemented as lists. Enum-sets would be more appropriately (and efficiently) implemented as numbers with an attached universe.
enum-set-union would be bitwise-ior, enum-set-
An implementation that translates enum-sets into numbers would make enum-sets much more interesting. Not long ago I needed just this in order to implement liveness analysis (where registers are perfect to put in enum-sets, and a bitwise-based implementation makes at least an order of magnitude difference in performance).
From what I see there's nothing that would prevent an implementation like this, it might even be the intended way to implement it.
Related branches
Changed in ikarus: | |
milestone: | none → 0.0.4 |
All of this seems correct. The current implementation of enum-sets was done while I was trying to understand their specification (i.e., with total disregard to efficiency). One problem I see is that some enum operations (e.g., enum-set=?, enum-set-subset?) may take enum-sets of different types and compares both the values of the enum-sets as well as their universes. I haven't thought much of how to do this efficiently (any ideas?).