Enumeration Storage via Ordinal Lookup Tables
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Modern object-oriented languages implement enumerations as classes, leading to reduced code efficiency and increased memory usage due to the representation of ordinal values as references rather than integral types, which results in less efficient loading and greater memory requirements.
Innovation Solution
Implementing space- and time-efficient enumerations by storing objects corresponding to enumerations along with a lookup table indexed by ordinal values, allowing ordinal values to be stored in memory locations and converted to object references using the lookup table, thereby reducing memory usage and improving loading efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If enumerations are implemented as classes with object references, then code readability and debugging are improved, but memory usage increases and code efficiency decreases
Solution Approach 1:
The patent segments the enumeration representation into two parts: a compact ordinal value for storage and a full object reference for operations. This allows the system to use only the minimal necessary data (ordinal value) for storage while maintaining full object capabilities when needed, thus reducing memory usage without sacrificing code readability.
Solution Approach 2:
The patent changes the parameter representation from full object references to compact ordinal values. By storing only the ordinal value (an integer) instead of a complete object reference, the memory required per enumeration instance is significantly reduced, while the ordinal value can still be used to retrieve the full object when needed for operations.
2Ease of operation
If enumerations are implemented as classes with object references, then debugging is improved, but code efficiency decreases
Solution Approach 1:
The patent performs preliminary action by pre-creating a lookup table that maps ordinal values to enumeration objects. This allows the system to store compact ordinal values while enabling efficient retrieval of full objects when needed for debugging or operations, thus maintaining debugging capability without the overhead of storing full object references.
Solution Approach 2:
The patent introduces a lookup table as an intermediary structure between the compact ordinal values and the full enumeration objects. This intermediary enables efficient conversion in both directions: from ordinal to object when debugging or operations are needed, and from object to ordinal for storage, thus maintaining debugging capability while improving storage efficiency.
3Ease of operation
If ordinal values are stored as object references, then operations are simplified, but memory locations become larger
Solution Approach 1:
The patent inverts the conventional approach by storing compact ordinal values instead of full object references. The lookup table provides the reverse mapping when full objects are needed for operations. This inversion reduces memory location size while maintaining operational simplicity through the intermediary lookup mechanism.
Data Source
AI summary
Systems, computer instructions and computer-implemented methods are disclosed for implementing space- and time-efficient enumerations. An instance of an enumeration class may be created with a constant, plurality of enumerations. A plurality of objects corresponding to the respective enumerations may be stored in memory along with a lookup table indexed by respective ordinal values of the plurality of enumerations, the lookup table including respective references to the stored objects of the instantiated enumeration class. A reference to an enumeration may be stored in a memory location by storing an ordinal value of the enumeration. A determination may then be made to convert a stored ordinal value to a reference to an object, and responsive to the determination, the ordinal value may be loaded and used as an index into the lookup table to obtain the reference to the object corresponding to the enumeration.


