Compiler-Generated Asynchronous Enumerable Object Memory Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The existing implementation of asynchronous iterators incurs significant memory overhead due to dynamic allocation of state data for each iteration, impacting program responsiveness and performance.

Innovation Solution

A single asynchronous enumerable object is generated that contains the data and methods needed to iterate through an enumerable asynchronously, reducing memory consumption by consolidating the roles of enumerator, awaitable, and awaiter into a single object.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If state data is stored in separate dynamically-allocated objects on heap for each iteration, then the iterator design pattern can be implemented with asynchronous operations, but memory allocation overhead and garbage collection costs significantly increase

Engineering Contradiction:
Improveasynchronous iteration capabilityVSAvoidmemory allocation overhead
Core Design Contradiction:
ReliabilityVSLoss of energy

Solution Approach 1:

The patent combines multiple separate objects (enumerator, awaitable, awaiter) into a single integrated iterator object. This merging eliminates the need for multiple dynamic allocations and garbage collection operations, directly resolving the memory overhead problem while preserving asynchronous iteration functionality.

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The iterator object is designed to perform multiple functions simultaneously: it acts as an enumerator for traversal, an awaitable for asynchronous operations, and an awaiter for suspension and resumption. This multi-functionality eliminates the need for separate specialized objects, reducing memory allocation overhead while maintaining full asynchronous capability.

Inventive Principle:
Principle #6Universality (Multi-functionality)

2Reliability

If separate objects are allocated for each iteration state, then asynchronous operations can be awaited and resumed, but program responsiveness and performance are adversely impacted

Engineering Contradiction:
Improveasynchronous operation handlingVSAvoidprogram responsiveness
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

By merging the enumerator, awaitable, and awaiter into a single object, the patent eliminates frequent garbage collection cycles that were causing performance degradation. This single-object approach maintains asynchronous operation handling while significantly improving program responsiveness by reducing memory management overhead.

Inventive Principle:
Principle #5Merging (Combining)

3Adaptability or versatility

If multiple separate objects are used for enumeration and asynchronous operations, then each object can be optimized for its specific function, but the overall system complexity and memory consumption increase

Engineering Contradiction:
Improvefunctional specializationVSAvoidobject structure complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent implements a universal iterator object that incorporates enumerator, awaitable, and awaiter functionalities. This multi-functional design reduces system complexity by eliminating the need to manage multiple separate objects and their interactions, while still providing all necessary specialized functions through integrated implementation.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The consolidation of multiple specialized objects into a single integrated object simplifies the overall system structure. Instead of managing separate allocations, lifecycles, and interactions between enumerator, awaitable, and awaiter objects, the system now manages a single unified object, directly reducing structural complexity.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentEP3759587B1Compiler-generated asynchronous enumerable object
Publication Date: 2024.11.27 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP3759587B1 patent drawingFigure 1
  • EP3759587B1 patent drawingFigure 2A
  • EP3759587B1 patent drawingFigure 2B

AI summary

A single asynchronous enumerable object is generated that contains the data and methods needed to iterate through an enumerable asynchronously. The asynchronous enumerable object contains the code for traversing the enumerable one step at a time and the operations needed to suspend an iteration to await completion of an asynchronous operation and to resume the iteration upon completion of the asynchronous operation. The allocation of a single object to perform all of these tasks reduces the memory consumption needed to execute an asynchronous enumeration.