Variable-Length Integer Decoding with Mask-Based Byte Detection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional decoding methods for variable length integers, such as LEB128, incur significant processing overhead due to iterative byte-by-byte processing and bitwise operations, becoming a performance bottleneck in high-throughput environments.

Innovation Solution

Employing native hardware instructions, particularly BMI2, to apply a mask to a series of bits representing variable length integers, extracting continuation bits to determine the number of bytes per integer, enabling efficient decoding through bulk bitwise operations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional iterative byte-by-byte decoding methods are used, then decoding accuracy is maintained, but processing overhead increases significantly

Engineering Contradiction:
Improvedecoding speedVSAvoidprocessor usage
Core Design Contradiction:
ProductivityVSUse of energy by moving object

Solution Approach 1:

The patent segments the bit series into fixed-size chunks (e.g., 64-bit words) and processes each chunk independently using vectorized operations. This segmentation enables parallel processing of multiple bytes simultaneously, dramatically improving decoding throughput while reducing per-byte processor overhead compared to traditional iterative methods

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent replaces the mechanical iterative byte-by-byte processing loop with hardware-accelerated vectorized bitwise operations. By substituting the software-based iterative approach with optimized bulk operations that leverage CPU instruction sets, the system achieves significant performance improvement while reducing processor cycle consumption

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

2Productivity

If bulk bitwise operations are applied, then processing efficiency increases, but implementation complexity increases

Engineering Contradiction:
Improvedecoding throughputVSAvoidimplementation complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent performs preliminary actions by pre-defining bit masks and shift amounts for different varint length scenarios. These pre-computed parameters are stored and reused during decoding, eliminating the need for complex runtime calculations and simplifying the implementation of bulk operations while maintaining high throughput

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent changes parameters by using fixed chunk sizes and standardized mask patterns that simplify the bulk operation logic. By standardizing these parameters, the implementation becomes more manageable despite the increased throughput, as the complexity is reduced to parameter management rather than complex control flow

Inventive Principle:
Principle #35Parameter changes

3Measurement precision

If mask operations are used to extract continuation bits, then byte determination accuracy is improved, but processing steps increase

Engineering Contradiction:
Improvebyte count determination accuracyVSAvoidprocessing time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent merges multiple operations into a single mask operation that extracts all continuation bits across an entire chunk of bytes simultaneously. This combined approach maintains precise determination of byte counts for each varint while eliminating the time loss associated with iterative checking, as all extractions happen in parallel within the bulk operation

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS20250355668A1Techniques for high-speed decoding of variable length integers
Publication Date: 2025.11.20 LEMON INC(GB)
  • US20250355668A1 patent drawing
  • US20250355668A1 patent drawing
  • US20250355668A1 patent drawing

AI summary

Described are examples for decoding variable length integers including obtaining a series of bits encoding one or more variable length integers, applying a mask to the series of bits to determine a number of bytes that correspond to each of the one or more variable length integers in the series of bits, and decoding each of the one or more variable length integers based on the number of bytes that correspond to each of the one or more variable length integers.