Query Optimizer for Code Refactoring and CPU Utilization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Modern programming languages that natively support queries, such as LINQ and Java Streams, can lead to inefficient program code due to poor understanding of query consequences and the practice of splitting methods, which existing code optimizers struggle to address effectively.

Innovation Solution

A query optimizer is implemented to detect inefficient queries in program code, generate functionally equivalent query sets using a ruleset, and extend laziness, optimizing queries during compilation or runtime based on execution conditions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If developers use native query support in programming languages (LINQ, Java Streams), then coding speed is improved, but query efficiency deteriorates due to poor understanding of query consequences

Engineering Contradiction:
Improvecoding speedVSAvoidquery inefficiency
Core Design Contradiction:
ProductivityVSObject-generated harmful factors

Solution Approach 1:

The system enables self-service by automatically analyzing and optimizing queries without requiring developer intervention. The query optimizer autonomously detects inefficient queries, generates optimized versions, and applies transformations, allowing the system to self-correct query inefficiencies that would otherwise require expert knowledge to fix.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system implements feedback by analyzing the consequences of query operations and using this information to generate optimized alternatives. The query optimizer evaluates query performance characteristics and feeds this analysis back into the optimization process, creating improved query versions that avoid identified inefficiencies.

Inventive Principle:
Principle #23Feedback

2Ease of operation

If developers split larger methods into smaller methods for readability, then code readability is improved, but query efficiency deteriorates due to loss of query context

Engineering Contradiction:
Improvecode readabilityVSAvoidquery performance degradation
Core Design Contradiction:
Ease of operationVSObject-generated harmful factors

Solution Approach 1:

The system applies segmentation by dividing the optimization process into distinct phases: detection of inefficient queries, analysis of query context across method boundaries, generation of optimized alternatives, and application of transformations. This segmented approach allows the system to maintain readability benefits while systematically addressing performance issues in split methods.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The query optimizer acts as an intermediary that bridges the gap between split method structures and query optimization needs. It analyzes queries across method boundaries, reconstructs the broader query context that would otherwise be lost, and generates optimized versions that maintain the benefits of method splitting while restoring query efficiency.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Productivity

If existing code optimizers are used, then some optimization is achieved, but they struggle to effectively address query inefficiencies in modern programming languages

Engineering Contradiction:
Improvecode optimizationVSAvoidquery optimization effectiveness
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system applies parameter changes by adapting optimization strategies specifically for modern query languages like LINQ and Java Streams. It modifies the optimization parameters and transformation rules to match the characteristics of these languages, enabling effective optimization where general-purpose optimizers fail.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The system substitutes the mechanical, rule-based approach of traditional code optimizers with a more sophisticated analysis engine that understands query semantics. It replaces simple pattern-matching mechanics with semantic analysis capabilities that can effectively handle the complexity of modern query expressions.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS10558458B2Query optimizer for CPU utilization and code refactoring
Publication Date: 2020.02.11 MICROSOFT TECHNOLOGY LICENSING LLC
  • US10558458B2 patent drawing
  • US10558458B2 patent drawing
  • US10558458B2 patent drawing

AI summary

Methods, systems, apparatuses, and computer program products are provided for increasing an efficiency of queries in program code. A plurality of queries is detected in program code. A laziness is extended by which the queries are evaluated in the program code. The queries are decomposed into a plurality of query components. A ruleset that includes a plurality of rules is applied to the query components to generate a functionally equivalent query set to the plurality of queries that evaluates more efficiently relative to the plurality of queries.