Fast Algorithms Supported by Theory (FAST) Kit provides algorithm acceleration capabilities for developers, built on the foundations of theoretical computer science. It currently provides APIs for Segment Map, rectangular partition solver, Digital Signal Processing (DSP), math prediction, and system performance optimization, helping improve app development experience and user experience.
Currently, FAST Kit includes the following functional domains:
Advanced data structure acceleration domain: This domain is designed to integrate advanced data structures backed by theoretical guarantees from theoretical computer science with modern hardware architectures. Currently, the Segment Map and ConcurrentHashMap data structures are provided.
Solver acceleration domain: This domain applies optimization solving capabilities from theoretical computer science and operations research to various scenarios in the HarmonyOS ecosystem. It currently provides the rectangular partition solver and polynomial root solver.
DSP acceleration domain: This domain aims to provide high-performance vector operations, Fast Fourier Transform (FFT), and second-order IIR filtering, all of which are already supported.
Collections acceleration domain. This domain provides high-performance container data structures. Currently, the HashMap data structure is provided.
Algorithm acceleration domain: This domain aims to provide high-performance general-purpose algorithms. It currently provides general-purpose sorting algorithms, supporting full sorting, partial sorting, and natural language string sorting for any data types.
Math Prediction acceleration domain: This domain aims to provide prediction capabilities based on historical sampling data. Currently, intelligent sequence prediction is provided.
Scheduling optimization acceleration domain: This domain allows apps to provide performance scenario information to the system. Based on this information, the system optimizes app performance within the effective scope of APIs whenever possible to improve user experience. Currently, system performance optimization APIs (ArkTS) and system performance optimization APIs (C/C++) are provided.
Use Cases
FAST Kit provides algorithm acceleration capabilities for optimizing app performance, workload, and power consumption based on theoretical computer science and optimized algorithms. Currently, FAST Kit provides the following capabilities: advanced data structure - Segment Map, solver - rectangular partition solver, solver - polynomial root solver, advanced data structure - ConcurrentHashMap, digital signal processing, and math prediction - intelligent sequence prediction. The details are as follows:
Segment Map: a data structure designed for efficient management of interval information, supporting rapid range updates and queries on data sequences. Here are some typical use cases:
- Data visualization: quickly responds to user requests for marking specific prices or time intervals in stock candlestick charts; efficiently renders the time intervals of a large number of tasks in Gantt charts or timelines.
- Resource monitoring and log analysis: records the time intervals during which stutters or exceptions occur in app performance monitoring, facilitating aggregate analysis on time periods with high-frequency issues; tracks continuous dwell-time intervals on specific pages to analyze user behavior patterns.
- Game development: manages multiple continuously effective skills or states in a game to check for overlaps or conflicts; projects objects onto axes as intervals to rapidly filter potential collision candidates.
Rectangular partition solver: used to solve the rectangular partition problem. It takes a set of non-overlapping rectangles as input and computes a rectangular partitioning scheme to generate a minimum number of rectangles that cover the same total area. Here are some typical use cases:
- UI rendering and layout optimization: merges the backgrounds of multiple adjacent UI controls into fewer viewport rectangles to reduce GPU drawing calls; merges the rendering areas of adjacent items in the virtual list to reduce the number of DOM elements or views.
- Game development: merges adjacent terrains or passable areas to optimize collision detection; merges adjacent lighting impact areas to simplify lighting calculation.
- Document and table processing: automatically merges adjacent cells of the same format in table applications; automatically merges multiple text labeling areas selected by a user into continuous areas.
Polynomial root solver: used to calculate the real roots of univariate polynomials. Here are some typical use cases:
- Computer-aided design: solves roots of parametric equations for curve and surface intersections; solves polynomial equations in geometric constraint solving.
- Signal processing: solves characteristic polynomials in digital filter design; calculates characteristic roots for system stability analysis.
- Control theory: calculates poles of control system transfer functions; solves characteristic equations in root locus analysis.
- Scientific computing: solves interpolation and approximation problems in numerical analysis; solves equations of motion in physics.
ConcurrentHashMap: a data structure specifically designed for high-concurrency scenarios, supporting safe and efficient key-value pair insertion, deletion, and lookup operations in multithreaded environments. Here are some typical use cases:
- Distributed system and middleware: manages massive volumes of key-value data in distributed cache clusters, supporting simultaneous read and write operations across multiple nodes; maintains consumer offsets or session states within message queues to guarantee consistency during concurrent updates.
- Real-time caching and database: caches market data or user sessions in high-frequency trading systems, supporting millisecond-level concurrent access; provides fast routing and resource sharing within database connection pools or query caches to prevent lock competition.
- Network and gateway services: records IP rate-limiting counts and updates routing policies in real time on API gateways or load balancers; manages concurrent user sessions on web servers to quickly locate and maintain state information.
Digital signal processing: provides high-performance vector operations, FFT computation, and second-order IIR filter capabilities, and supports single-precision and double-precision arithmetic operations. Here are some typical use cases:
- FFT: applies to spectrum analysis, frequency domain filtering, signal reconstruction, audio processing, vibration analysis, and more.
- Audio signal processing: Includes audio noise reduction, equalizer (EQ), low-pass/high-pass/band-pass filtering, and multi-channel audio processing.
- Sensor data analysis: Includes filtering and feature extraction of accelerometer, gyroscope, and other sensor data, as well as real-time signal peak detection and statistical calculations.
- Communication and signal analysis: Includes complex signal format conversion (interleaved/separated formats), vector dot product operations, and signal energy calculation.
Generic and natural language sorting: provides high-performance generic sorting algorithms, and supports full sorting, partial sorting, and natural language string sorting of any data types. Here are some typical use cases:
- Data preprocessing: sorts basic data types such as integers and floating-point numbers to prepare for subsequent operations such as binary search, and sorts user-defined types by specific fields.
- Top-K selection: quickly retrieves the top K maximum or minimum elements from an array without needing a full sort; finds medians; calculates quantiles.
- File list sorting: sorts file names in natural order (for example, file1.txt, file2.txt, file10.txt); sorts version number strings (for example, v1.0, v1.10, v2.0).
- Multilingual text sorting: supports natural sorting of multilingual text encoded in UTF-8; sorts numbered resources (for example, img1, img2, img10).
- Machine learning inference: performs preprocessing operations such as feature vector computation, vector normalization, and statistical feature extraction.
Intelligent sequence prediction: uses built-in FAST Kit algorithms to predict the sequence value at the next time step based on historical sampling data. Here are some typical use cases:
- Gesture tracking: predicts the index position of the touch point in the next frame based on the historical positions and timestamps of touch points, reducing touch tracking latency.
- Animation curve prediction: predicts the trend of subsequent frame index changes based on existing keyframe index-time samples of animation curves, enabling smoother animation transitions.
- Motion trajectory estimation: predicts the subsequent position of an object based on sampled historical motion trajectories in games or interactive apps, improving response speed.
- Scroll inertia prediction: predicts the final stop position during deceleration based on sampled historical scroll offsets in list scrolling scenarios.
HashMap: a high-performance key-value data structure that supports insertion, deletion, and lookup operations. It is optimized for single-threaded scenarios. Here are some typical use cases:
- App startup and initialization: quickly builds configuration index tables during app startup to accelerate resource loading and initialization processes; preloads frequently used data into an in-memory HashMap to reduce subsequent lookup latency.
- Cache and status management: stores key-value data such as user preferences and session tokens in local cache systems; maintains fast access to real-time data such as player states and item attributes in games or other types of apps.
- Indexing and lookup optimization: builds keyword-to-location indexes in document editors to enable fast positioning and highlighting; builds tag-to-article mappings in content management systems to support fast retrieval and categorization.
- Deduplication and counting: counts the occurrences of specific events in log analysis systems; maintains a set of processed request IDs in network apps to prevent duplicate processing; quickly identifies and filters duplicate records during data cleaning.
- Configuration and metadata management: caches service registration information and routing configurations in microservice architectures; quickly reads and updates configuration parameters dynamically loaded at app runtime.
System performance optimization: allows apps to provide performance scenario information to the system. Based on this information, the system optimizes app performance whenever possible within the effective scope of the APIs to improve user experience. Here are some typical use cases:
- App startup optimization: During key app startup phases, use the perfHint API to hint the system to accelerate the app startup process whenever possible.
- Page transition optimization: During page transitions, use the perfHint API to hint the system to reduce page transition stuttering whenever possible.
- Page loading optimization: During page loading, use the perfHint API to hint the system to improve page loading speed whenever possible.
- Network file processing optimization: In network file processing scenarios, use the perfHint API to hint the system to accelerate network file processing whenever possible.
- Local file processing optimization: In local file processing scenarios, use the perfHint API to hint the system to accelerate local file processing whenever possible.
- Page rendering optimization: In page rendering scenarios, use the perfHint API to hint the system to improve page rendering smoothness whenever possible.
- Animation playback optimization: In animation playback scenarios, use the perfHint API to hint the system to ensure smooth animation playback whenever possible.
- Media playback optimization: In media playback scenarios, use the perfHint API to hint the system to improve playback smoothness whenever possible.
- Media encoding/decoding optimization: In audio and video encoding/decoding processing scenarios, use the perfHint API to hint the system to improve processing efficiency whenever possible.
Basic Concepts
Opaque configuration: An ABI-stable configuration abstraction mechanism where a library forward-declares configuration objects as incomplete types. External code interacts with these objects solely through pointer handles. Since the size, field layout, and interpretation rules are defined entirely within the library, the implementation details are fully decoupled from the caller. This ensures that the storage format and semantics can be modified in future versions without breaking binary compatibility.
[h2]Supported Countries/Regions
Currently, this kit is available only in the Chinese mainland.
[h2]Supported Device Types
| Capability Provided by FAST Kit | Supported Device Type |
| Segment Map data structure | Phones, tablets, and PCs/2-in-1 devices |
| ConcurrentHashMap data structure | Phones, tablets, and PCs/2-in-1 devices |
| Rectangular partition solver | Phones, tablets, and PCs/2-in-1 devices |
| Polynomial root solver | Phones, tablets, and PCs/2-in-1 devices |
| Vector operations | Phones, tablets, and PCs/2-in-1 devices |
| FFT | Phones, tablets, and PCs/2-in-1 devices |
| Second-order IIR filter | Phones, tablets, and PCs/2-in-1 devices |
| HashMap data structure | Phones, tablets, and PCs/2-in-1 devices |
| Generic sorting algorithm | Phones, tablets, and PCs/2-in-1 devices |
| Intelligent sequence prediction | Phones, tablets, and PCs/2-in-1 devices |
| System performance optimization (ArkTS) | Phones, tablets, PCs/2-in-1 devices, wearables, and TVs |
| System performance optimization (C/C++) | Phones, tablets, PCs/2-in-1 devices, wearables, and TVs |