Template Compilation Using View Transforms for DOM Nodes

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current template compilation methods for generating web pages are inefficient, requiring runtime parsing and interpretation, which leads to slower rendering and increased complexity in code optimization, making it difficult for developers to maintain and optimize large code sets.

Innovation Solution

A method that identifies and parses code templates to apply defined transforms to DOM nodes, generating optimized code that transforms these nodes, which is then transmitted for presentation, extending the templating language's syntax and enabling efficient code generation and management.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If runtime parsing and interpretation is used for template compilation, then template processing flexibility is maintained, but rendering speed decreases and code optimization complexity increases

Engineering Contradiction:
Improverendering speedVSAvoidcode optimization complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The template is parsed and compiled into optimized code before runtime execution. The compiler pre-processes the template, identifies transforms, generates optimized code, and replaces DOM nodes in advance, so that during runtime only the generated code needs to be executed without re-parsing the template syntax.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent replaces the mechanical runtime parsing and interpretation process with a compilation process that generates optimized code. Instead of interpreting template syntax at runtime, the system compiles templates into efficient execution code that directly manipulates DOM nodes, eliminating the need for complex runtime parsing mechanisms.

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

2Productivity

If runtime parsing is used for template processing, then template syntax flexibility is preserved, but code execution efficiency decreases

Engineering Contradiction:
Improvecode execution efficiencyVSAvoidruntime parsing time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The template parsing and transformation logic is performed in advance during the compilation phase rather than at runtime. The compiler pre-processes the template, identifies all transforms, generates optimized code, and replaces DOM nodes before execution, eliminating runtime parsing overhead.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates a compiled version of the template code that copies the structure and logic of the original template but optimizes it for execution. The generated code replicates the template's functionality while using efficient direct DOM manipulation instead of runtime parsing, achieving both flexibility and speed.

Inventive Principle:
Principle #26Copying

3Productivity

If hand-optimized code is written by developers, then code efficiency can be maximized, but development time and maintenance complexity increase

Engineering Contradiction:
Improvecode efficiencyVSAvoidcode development ease
Core Design Contradiction:
ProductivityVSEase of manufacture

Solution Approach 1:

The compiler automatically performs code optimization without requiring developer intervention. It autonomously identifies transforms, generates optimized code, and replaces DOM nodes based on the template syntax, eliminating the need for developers to manually write optimized code while maintaining high efficiency.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system changes the state of template code from raw syntax to compiled optimized code through parameter transformation. The compiler transforms template parameters and syntax into efficient execution code, automatically adjusting optimization parameters based on the template structure and transform definitions.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS10331781B2Template compilation using view transforms
Publication Date: 2019.06.25 GOOGLE LLC
  • US10331781B2 patent drawing
  • US10331781B2 patent drawing
  • US10331781B2 patent drawing

AI summary

Methods, systems, and apparatus include computer programs encoded on a computer-readable storage medium for template compilation. A method includes: identifying, within a portion of code, a code template; parsing the template to identify a defined transform and a DOM node to which the transform is to be applied; generating, based on the defined transform and the DOM node, a set of code that transforms the DOM node according to the defined transform; replacing the DOM node with the set of code; and transmitting, to a user device, the set of code to present the transformed DOM node at the user device.