Zhidaily AI · Intelligence · Daily
Zhidaily
Issue 14 · November 13, 2026 · Fri
Today's stories
16 stories · 6 companies
Home / November 13, 2026 / HarmonyOS 7 FAST Kit: Sorting and FFT in Practice
← Back
Guide News Score72

HarmonyOS 7 FAST Kit: Sorting and FFT in Practice

InfoQ China HarmonyOS · RSS · infoq.cn
Nov 12 · 18:20 Read the original ↗
01Summary

HarmonyOS 7 (API 26) ships FAST Kit, a system-level service that packages performance-sensitive low-level algorithms so apps can call them instead of writing and tuning their own. The author tests two of them — natural-language sorting and a 4096-point FFT — in one reproducible demo project, to see how much work integration really takes and whether the speedup holds up.

02Background

HarmonyOS 7 (API 26) ships FAST Kit, a system-level service that packages performance-sensitive low-level algorithms so apps can call them instead of writing and tuning their own. The author tests two of them — natural-language sorting and a 4096-point FFT — in one reproducible demo project, to see how much work integration really takes and whether the speedup holds up.

03Solution

Both capabilities are Native C only, so the ArkTS side must go through a NAPI bridge: convert strings or sample arrays to C pointers, call HMS_FAST_*, and convert back. Two build traps cost time. From API 26, compatibleSdkVersion must use the new dotted form "26.0.0"; the old "X.Y.Z(NN)" style fails with error 00308018. And libfast_utils.so lives in the HMS sysroot under a GNU triplet directory name (aarch64-linux-ohos), not the ABI name, so a plain -lfast_utils link fails. For sorting, the author compared FAST Kit against ArkTS Intl.Collator at 1k, 10k and 100k items. At 10k, time fell from 146 ms to 20 ms; at 100k the gap widened further, and a second run deployed via hdc measured 51/262/2381 ms versus 4/30/203 ms — roughly 7–13x. Every run's sorted output hashed identically to the baseline, so the speedup is on equivalent results. The author cautions this cannot be compared with the official 60–70% figure, which uses a different baseline (a third-party internationalization library). For FFT, the library provides only the transform; windowing, amplitude calibration and one-sided spectrum conversion are the app's job. The first spectrum chart drew no bars even though peak detection found 50/120/300 Hz: the tones landed exactly on integer bins, so the rectangular window's sidelobes were zero everywhere the chart sampled. Adding a Hann window before the transform widened the peaks into visible lines, at the cost of a 2x coherent-gain correction. Amplitude calibration checked out (0.600/0.300/0.150 recovered from 0.60/0.30/0.15 inputs), and a 4096-point transform took about 0.02–0.03 ms — but only on the emulator, with transfer and drawing excluded.

04Takeaway

FAST Kit can deliver large, result-equivalent speedups for long lists and cheap FFTs, but the integration cost is real: native bridging, strict build configuration, and signal-processing details the library leaves to you. Validate correctness first, then measure on real devices at your minimum supported version, with fallbacks ready.