一句话:提出面向GPU的无分支高并行JSON解析算法,将UTF验证、分词与嵌套结构识别整体卸载到GPU,性能超越CPU与GPU基线解析器。
JSON解析在现代计算中常成为性能瓶颈,而传统观点认为解析算法分支密集,不适合GPU。本文提出cuJSON,一种基于全新解析算法、专为GPU架构设计的JSON解析器,其核心是最小化分支、最大化并行度。cuJSON将JSON解析的三个主要阶段——UTF验证、分词以及嵌套结构识别——全部卸载到GPU,每个阶段都由面向GPU优化的并行算法驱动,并利用GPU内建函数与高性能CUDA库加速。为提升解析速度,其输出格式也被设计为便于并行构建;同时cuJSON打破了传统解析过程中的关键依赖,使得单个大型JSON文件也能被有效并行解析。评估表明,cuJSON在功能与性能上均优于高度优化的CPU解析器simdjson与Pison,也超过了已有的GPU解析器cuDF与GPJSON,源码已开源。
JSON (JavaScript Object Notation) data is widely used in modern computing, yet its parsing performance can be a major bottleneck. Conventional wisdom suggests that GPUs are ill-suited for parsing due to the branch-heavy nature of parsing algorithms. This work challenges that notion by presenting cuJSON, a novel JSON parser built on a new parsing algorithm, specifically tailored for GPU architectures with minimal branching and maximal parallelism. cuJSON offloads three main phases of JSON parsing to the GPU, including (i) UTF validation, (ii) tokenization, and (iii) nesting structure recognition. Each phase is powered by a parallel algorithm optimized for GPUs, leveraging intrinsic GPU functions and high-performance CUDA libraries for acceleration. To maximize parsing speed, cuJSON's output format is also designed to facilitate parallel construction. Finally, cuJSON can break key dependencies in the parsing process, enabling parallel parsing of a single large JSON file effectively. Evaluation shows that cuJSON not only outperforms highly optimized CPU-based parsers like simdjson and Pison but also surpasses existing GPU-based parsers like cuDF and GPJSON, in terms of both functionality and performance. The source code of cuJSON is available at https://github.com/AutomataLab/cuJSON.