{"id":93870,"date":"2026-08-13T10:49:25","date_gmt":"2026-08-13T02:49:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/93870.html"},"modified":"2026-08-13T10:49:25","modified_gmt":"2026-08-13T02:49:25","slug":"simdjson%ef%bc%9a%e5%88%a9%e7%94%a8-simd-%e6%8c%87%e4%bb%a4%e5%ae%9e%e7%8e%b0-gb-s-%e7%ba%a7-json-%e8%a7%a3%e6%9e%90%e7%9a%84-c-%e5%bc%80%e6%ba%90%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/93870.html","title":{"rendered":"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93"},"content":{"rendered":"<p>\u9002\u7528\u8bfb\u8005&#xff1a;\u521a\u5165\u95e8 C&#043;&#043; \u7684\u5f00\u53d1\u8005\u3001\u88ab JSON \u89e3\u6790\u901f\u5ea6\u56f0\u6270\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\u3001\u4e00\u5207\u5bf9&#034;\u6bcf\u79d2\u80fd\u5403\u6389\u591a\u5c11\u6761\u65e5\u5fd7&#034;\u6709\u6267\u5ff5\u7684\u4eba\u3002 \u672c\u6587\u7ea6\u5b9a&#xff1a;\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u57fa\u4e8e simdjson\u00a0v3.x&#xff08;\u5411\u4e0b\u517c\u5bb9 v2.x \u7684 DOM \u7528\u6cd5&#xff09;&#xff0c;\u8981\u6c42 C&#043;&#043;17 \u53ca\u4ee5\u4e0a\u3002<\/p>\n<h3 id=\"1-\u8fd9\u5e93\u662f\u4ec0\u4e4830-\u79d2\u8ba4\u8bc6-simdjson\">1. \u8fd9\u5e93\u662f\u4ec0\u4e48&#xff1a;30 \u79d2\u8ba4\u8bc6 simdjson<\/h3>\n<p>simdjson\u00a0\u662f\u4e00\u4e2a\u7528 C&#043;&#043; \u7f16\u5199\u7684\u9ad8\u6027\u80fd JSON \u89e3\u6790\u5e93&#xff0c;\u6838\u5fc3\u5356\u70b9\u5c31\u4e00\u53e5\u8bdd&#xff1a;<\/p>\n<p>\u522b\u4eba\u89e3\u6790 JSON \u7684\u5355\u4f4d\u662f&#034;\u5146\u5b57\u8282\u6bcf\u79d2&#xff08;MB\/s&#xff09;&#034;&#xff0c;\u5b83\u76f4\u63a5\u5e72\u5230\u4e86&#034;\u5409\u5b57\u8282\u6bcf\u79d2&#xff08;GB\/s&#xff09;&#034;&#xff0c;\u5feb\u4e86 10~50 \u500d\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u80fd\u505a\u5230&#xff1f;\u56e0\u4e3a\u5b83\u5728 CPU \u5c42\u9762\u7528\u4e0a\u4e86\u00a0SIMD&#xff08;Single Instruction, Multiple Data&#xff0c;\u5355\u6307\u4ee4\u591a\u6570\u636e&#xff09;\u00a0\u6307\u4ee4\u3002\u666e\u901a\u7a0b\u5e8f\u5904\u7406 JSON \u662f\u4e00\u4e2a\u5b57\u7b26\u4e00\u4e2a\u5b57\u7b26&#034;\u6392\u961f\u8fc7\u5b89\u68c0&#034;&#xff0c;\u800c simdjson \u8ba9 CPU\u00a0\u4e00\u6b21\u6307\u4ee4\u540c\u65f6\u68c0\u67e5 32 \u4e2a\u5b57\u7b26&#xff0c;\u76f8\u5f53\u4e8e\u628a\u5355\u901a\u9053\u5b89\u68c0\u53e3\u6362\u6210\u4e86 32 \u901a\u9053\u5e76\u884c\u5b89\u68c0\u53e3\u3002<\/p>\n<p>\u6253\u4e2a\u6bd4\u65b9&#xff1a;\u4f20\u7edf\u89e3\u6790\u5668\u50cf\u4eba\u5de5\u6284\u5199\u5458&#xff0c;\u4e00\u4e2a\u5b57\u6bcd\u4e00\u4e2a\u5b57\u6bcd\u5730\u6284&#xff1b;simdjson \u50cf\u4e00\u53f0\u9ad8\u901f\u626b\u63cf\u4eea&#xff0c;\u4e00\u9875\u7eb8&#034;\u5530&#034;\u5730\u4e00\u4e0b\u6574\u9875\u8fdb&#xff0c;\u6574\u9875\u51fa\u3002<\/p>\n<p>\u6ce8\u610f\u5b9a\u4f4d&#xff1a;\u6211\u4eec\u4e4b\u524d\u5199\u8fc7\u4e00\u7bc7\u00a0nlohmann\/json \u5f00\u6e90 JSON \u5e93\u00a0\u7684\u535a\u5ba2&#xff0c;\u90a3\u662f&#034;\u901a\u7528\u6613\u7528\u6d3e&#034;\u7684\u4ee3\u8868&#xff08;\u529f\u80fd\u5168\u3001\u5199\u8d77\u6765\u723d&#xff09;&#xff1b;\u800c simdjson \u662f&#034;\u6781\u81f4\u6027\u80fd\u6d3e&#034;\u7684\u4ee3\u8868&#xff08;\u5feb\u3001\u7701\u5185\u5b58\u3001\u53ea\u8bfb\u4e0d\u5199&#xff09;\u3002\u4e24\u8005\u5b9a\u4f4d\u4e0d\u540c&#xff1a;nlohmann\/json \u662f\u968f\u8eab\u745e\u58eb\u519b\u5200&#xff0c;simdjson \u662f\u5de5\u4e1a\u7ea7\u4f20\u9001\u5e26\u3002\u672c\u6587\u4e3b\u89d2\u662f\u540e\u8005\u3002<\/p>\n<hr \/>\n<h3 id=\"2-\u5f00\u6e90\u80cc\u666f\u4f5c\u8005\u534f\u8baestar-\u91cf\u7ea7\">2. \u5f00\u6e90\u80cc\u666f&#xff1a;\u4f5c\u8005\u3001\u534f\u8bae\u3001Star \u91cf\u7ea7<\/h3>\n<table>\n<tbody>\n<tr>\u9879\u76ee\u8bf4\u660e<\/tr>\n<tr>\n<td style=\"width:87px\">\u9879\u76ee\u4e3b\u9875<\/td>\n<td style=\"width:601px\">github.com\/simdjson\/simdjson<\/td>\n<\/tr>\n<tr>\n<td style=\"width:87px\">\u4e3b\u8981\u4f5c\u8005<\/td>\n<td style=\"width:601px\">Daniel Lemire&#xff08;\u52a0\u62ff\u5927\u9b41\u5317\u514b\u5927\u5b66\u6559\u6388&#xff0c;\u6570\u636e\u79d1\u5b66\/\u9ad8\u6027\u80fd\u8ba1\u7b97\u9886\u57df\u77e5\u540d\u5b66\u8005&#xff09;&#xff0c;\u6838\u5fc3\u8d21\u732e\u8005\u8fd8\u5305\u62ec John Keiser\u3001Geoff Langdale \u7b49<\/td>\n<\/tr>\n<tr>\n<td style=\"width:87px\">\u9996\u6b21\u53d1\u5e03<\/td>\n<td style=\"width:601px\">2019 \u5e74&#xff08;\u914d\u5957\u8bba\u6587\u00a0Parsing gigabytes of JSON per second\u00a0\u53d1\u8868\u4e8e VLDB Journal&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"width:87px\">\u5f00\u6e90\u534f\u8bae<\/td>\n<td style=\"width:601px\">Apache License 2.0&#xff08;\u5bbd\u677e\u5546\u4e1a\u53cb\u597d&#xff0c;\u53ef\u81ea\u7531\u5546\u7528\u3001\u4fee\u6539\u3001\u5206\u53d1&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"width:87px\">Star \u91cf\u7ea7<\/td>\n<td style=\"width:601px\">20k&#043;&#xff08;\u622a\u81f3 2026 \u5e74&#xff0c;\u957f\u671f\u4f4d\u5217 C&#043;&#043; \u9ad8\u6027\u80fd\u5e93\u5934\u90e8&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"width:87px\">\u8bed\u8a00\u8981\u6c42<\/td>\n<td style=\"width:601px\">C&#043;&#043;17 \u53ca\u4ee5\u4e0a&#xff0c;\u7eaf\u5934\u6587\u4ef6 &#043; \u5c11\u91cf\u6e90\u6587\u4ef6&#xff0c;\u8de8\u5e73\u53f0&#xff08;Windows \/ Linux \/ macOS \/ ARM&#xff09;<\/td>\n<\/tr>\n<tr>\n<td style=\"width:87px\">\u5b98\u65b9\u6027\u80fd<\/td>\n<td style=\"width:601px\">\u5b98\u65b9\u57fa\u51c6&#xff1a;\u5728 4GHz Skylake&#xff08;\u652f\u6301 AVX2&#xff09;\u4e0a\u89e3\u6790 Twitter JSON \u6570\u636e\u96c6\u53ef\u8fbe\u00a02.5&#043; GB\/s<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u26a0\ufe0f Star \u6570\u662f\u52a8\u6001\u6570\u636e&#xff0c;\u5199\u4f5c\u65f6\u4ee5 GitHub \u9875\u9762\u5b9e\u65f6\u4e3a\u51c6&#xff1b;\u672c\u6587\u7ed9\u51fa\u7684\u91cf\u7ea7\u7528\u4e8e\u8bf4\u660e&#034;\u8fd9\u662f\u793e\u533a\u516c\u8ba4\u7684\u4e3b\u6d41\u9ad8\u6027\u80fd\u5e93&#034;\u3002<\/p>\n<p>simdjson \u7684\u8bde\u751f\u80cc\u666f\u5f88\u76f4\u63a5&#xff1a;JSON \u5df2\u7ecf\u6210\u4e3a\u4e92\u8054\u7f51\u4e8b\u5b9e\u6807\u51c6\u6570\u636e\u683c\u5f0f&#xff0c;\u4f46\u4f20\u7edf\u89e3\u6790\u5668&#xff08;\u5982 nlohmann\/json\u3001RapidJSON \u7684\u666e\u901a\u6a21\u5f0f&#xff09;\u5728\u5927\u91cf\u573a\u666f\u4e0b\u53ea\u80fd\u8dd1\u5230 100~400 MB\/s\u3002\u5bf9&#034;\u6bcf\u79d2\u949f\u8981\u5904\u7406\u51e0 GB \u65e5\u5fd7&#034;\u7684\u56e2\u961f\u6765\u8bf4&#xff0c;\u89e3\u6790\u5668\u5c31\u662f\u74f6\u9888\u3002Daniel Lemire \u56e2\u961f\u4ece 2016 \u5e74\u524d\u540e\u5f00\u59cb\u7814\u7a76\u7528 SIMD \u52a0\u901f JSON \u7ed3\u6784\u8bc6\u522b&#xff0c;\u6700\u7ec8\u4ea7\u51fa\u4e86\u8fd9\u4e2a\u5e93\u3002<\/p>\n<hr \/>\n<h3 id=\"3-\u4e3a\u4ec0\u4e48\u8981\u7528\u56db\u5927\u4f18\u70b9\u9010\u4e2a\u62c6\u89e3\">3. \u4e3a\u4ec0\u4e48\u8981\u7528&#xff1a;\u56db\u5927\u4f18\u70b9\u9010\u4e2a\u62c6\u89e3<\/h3>\n<h4 id=\"31-\u4f18\u70b9\u4e00simd-\u52a0\u901f\u539f\u7406\u8ba9-cpu-\u4e00\u628a\u6293\">3.1 \u4f18\u70b9\u4e00&#xff1a;SIMD \u52a0\u901f\u539f\u7406\u2014\u2014\u8ba9 CPU &#034;\u4e00\u628a\u6293&#034;<\/h4>\n<h5 id=\"\u7b2c-1-\u6b65\u7406\u89e3-simd-\u662f\u4ec0\u4e48\">\u7b2c 1 \u6b65&#xff1a;\u7406\u89e3 SIMD \u662f\u4ec0\u4e48<\/h5>\n<p>\u666e\u901a CPU \u6307\u4ee4\u4e00\u6b21\u5904\u7406\u4e00\u4e2a\u6570\u636e&#xff08;\u6bd4\u5982\u4e00\u6b21\u8bfb 1 \u4e2a\u5b57\u8282&#xff09;\u3002SIMD \u6307\u4ee4&#xff08;x86 \u4e0a\u7684 SSE\/AVX2\/AVX-512\u3001ARM \u4e0a\u7684 NEON&#xff09;\u5141\u8bb8 CPU\u00a0\u4e00\u6b21\u52a0\u8f7d 16\/32\/64 \u4e2a\u5b57\u8282\u5230\u540c\u4e00\u4e2a&#034;\u5927\u5bc4\u5b58\u5668&#034;\u91cc&#xff0c;\u7136\u540e\u4e00\u6761\u6307\u4ee4\u540c\u65f6\u5bf9\u5b83\u4eec\u505a\u8fd0\u7b97\u3002<\/p>\n<p>\u7c7b\u6bd4&#xff1a;\u666e\u901a\u6a21\u5f0f\u662f&#034;\u4e00\u4e2a\u90ae\u9012\u5458\u4e00\u6b21\u9001\u4e00\u5c01\u4fe1&#034;&#xff0c;AVX2 \u6a21\u5f0f\u662f&#034;\u4e00\u4e2a\u90ae\u9012\u5458\u9a91\u7740\u4e09\u8f6e\u8f66\u4e00\u6b21\u9001 32 \u5c01\u4fe1&#034;\u3002<\/p>\n<h5 id=\"\u7b2c-2-\u6b65json-\u89e3\u6790\u7684\u74f6\u9888\u5728\u54ea\u91cc\">\u7b2c 2 \u6b65&#xff1a;JSON \u89e3\u6790\u7684\u74f6\u9888\u5728\u54ea\u91cc<\/h5>\n<p>\u89e3\u6790 JSON \u6700\u8017\u65f6\u7684\u5de5\u4f5c&#xff0c;\u4e0d\u662f&#034;\u8bfb\u6570\u5b57&#034;&#xff0c;\u800c\u662f\u626b\u63cf\u6574\u6bb5\u6587\u672c\u627e\u7ed3\u6784\u7b26\u53f7&#xff1a;<\/p>\n<li>\u627e\u00a0{ } [ ] : ,\u00a0\u8fd9\u4e9b&#034;\u9aa8\u67b6\u7b26\u53f7&#034;&#xff08;structural character&#xff09;&#xff1b;<\/li>\n<li>\u5224\u65ad\u54ea\u4e9b\u5f15\u53f7\u662f\u5b57\u7b26\u4e32\u7684\u5f15\u53f7\u3001\u54ea\u4e9b\u662f\u8f6c\u4e49\u00a0\\\\&#034;\u00a0\u7684\u4e00\u90e8\u5206&#xff08;\u907f\u514d\u628a\u5b57\u7b26\u4e32\u91cc\u7684\u00a0:\u00a0\u8bef\u5224\u6210\u952e\u503c\u5206\u9694\u7b26&#xff09;&#xff1b;<\/li>\n<li>\u5224\u65ad\u54ea\u4e9b\u7a7a\u767d\u53ef\u4ee5\u88ab\u8df3\u8fc7\u3002<\/li>\n<p>\u4f20\u7edf\u89e3\u6790\u5668\u9010\u5b57\u8282\u5224\u65ad&#xff0c;if (c &#061;&#061; &#039;{&#039; || c &#061;&#061; &#039;}&#039; || &#8230;)\u00a0\u4e00\u8def\u6bd4\u4e0b\u53bb&#xff0c;\u9047\u5230 1GB \u6587\u672c\u5c31\u8981\u505a\u51e0\u5341\u4ebf\u6b21\u5355\u5b57\u8282\u6bd4\u8f83\u3002<\/p>\n<h5 id=\"\u7b2c-3-\u6b65simdjson-\u600e\u4e48\u7528-simd-\u52a0\u901f\">\u7b2c 3 \u6b65&#xff1a;simdjson \u600e\u4e48\u7528 SIMD \u52a0\u901f<\/h5>\n<p>simdjson \u7684\u6838\u5fc3\u6280\u5de7&#xff08;\u8bba\u6587\u91cc\u53eb\u00a0structural character identification&#xff09;\u5206\u4e09\u5c42&#xff1a;<\/p>\n<li>\u4e00\u6b21\u5904\u7406 32\/64 \u5b57\u8282&#xff1a;\u7528 AVX2 \u4e00\u6b21\u52a0\u8f7d 32 \u5b57\u8282&#xff0c;\u7528\u00a0_mm256_cmpeq_epi8&#xff08;\u9010\u5b57\u8282\u76f8\u7b49\u6bd4\u8f83&#xff09;\u00a0\u4e4b\u7c7b\u7684\u6307\u4ee4&#xff0c;\u540c\u65f6\u5224\u65ad\u8fd9 32 \u4e2a\u5b57\u8282\u91cc\u54ea\u4e9b\u662f\u00a0{\u3001\u54ea\u4e9b\u662f\u00a0}\u2026\u2026\u6240\u6709\u6bd4\u8f83\u90fd\u5728\u4e00\u6761\u6307\u4ee4\u91cc\u5b8c\u6210&#xff0c;\u7ed3\u679c\u662f\u4e00\u4e2a 32 \u4f4d\u7684\u63a9\u7801&#xff08;bitmask&#xff09;&#xff0c;\u6bcf\u4e00\u4f4d\u5bf9\u5e94\u4e00\u4e2a\u5b57\u8282&#034;\u662f\u4e0d\u662f\u67d0\u7c7b\u5b57\u7b26&#034;\u3002<\/li>\n<li>\u591a\u8def\u5e76\u884c\u6bd4\u8f83\u5408\u5e76&#xff1a;\u5206\u522b\u5f97\u5230&#034;\u662f\u82b1\u62ec\u53f7\u7684\u63a9\u7801&#034;&#034;\u662f\u65b9\u62ec\u53f7\u7684\u63a9\u7801&#034;&#034;\u662f\u5f15\u53f7\u7684\u63a9\u7801&#034;\u7b49&#xff0c;\u518d\u7528\u4f4d\u8fd0\u7b97\u00a0OR\u00a0\u5408\u5e76\u6210\u4e00\u5f20&#034;\u7ed3\u6784\u7b26\u53f7\u4f4d\u56fe&#034;\u3002<\/li>\n<li>\u5feb\u901f\u8df3\u8fc7\u5b57\u7b26\u4e32\u4e0e\u8f6c\u4e49&#xff1a;\u5b57\u7b26\u4e32\u5185\u90e8\u7528 SIMD \u627e\u00a0&#034;\u00a0\u548c\u00a0\\\\&#xff0c;\u4e00\u6b21\u8df3\u8fc7\u6574\u4e2a\u5b57\u7b26\u4e32\u5185\u5bb9&#xff0c;\u800c\u4e0d\u662f\u9010\u5b57\u7b26\u8d70\u8fdb\u5b57\u7b26\u4e32\u3002<\/li>\n<p>\u6700\u7ec8\u6548\u679c&#xff1a;\u65e0\u8bba JSON \u91cc\u6709\u591a\u5c11\u5185\u5bb9&#xff0c;\u8bc6\u522b\u7ed3\u6784\u7b26\u53f7\u7684\u5f00\u9500\u4ece&#034;\u6bcf\u5b57\u8282\u82e5\u5e72\u6761\u6307\u4ee4&#034;\u964d\u5230&#034;\u6bcf 32 \u5b57\u8282\u82e5\u5e72\u6761\u6307\u4ee4&#034;&#xff0c;\u8fd9\u5c31\u662f\u6570\u91cf\u7ea7\u7684\u5dee\u8ddd\u6765\u6e90\u3002<\/p>\n<p>\u5c0f\u767d\u7c7b\u6bd4&#xff1a;\u4f20\u7edf\u89e3\u6790\u662f&#034;\u62ff\u7740\u653e\u5927\u955c\u9010\u5b57\u6838\u5bf9\u9519\u522b\u5b57&#034;&#xff0c;simdjson \u662f&#034;\u6574\u6bb5\u6587\u5b57\u7528 OCR \u626b\u63cf\u4eea\u4e00\u6b21\u8fc7&#034;\u2014\u2014\u626b\u63cf\u4eea\u5f53\u7136\u4e5f\u6709\u4ee3\u4ef7&#xff08;\u8981\u5148\u51d1\u9f50 32 \u4e2a\u5b57\u8282&#xff09;&#xff0c;\u4f46\u541e\u5410\u91cf\u5b8c\u80dc\u3002<\/p>\n<h4 id=\"32-\u4f18\u70b9\u4e8cgbs-\u7ea7\u6027\u80fd\u5feb\u5230\u4ec0\u4e48\u7a0b\u5ea6\">3.2 \u4f18\u70b9\u4e8c&#xff1a;GB\/s \u7ea7\u6027\u80fd\u2014\u2014\u5feb\u5230\u4ec0\u4e48\u7a0b\u5ea6<\/h4>\n<p>\u5b98\u65b9\u4e0e\u7b2c\u4e09\u65b9\u57fa\u51c6\u666e\u904d\u7ed9\u51fa\u5982\u4e0b\u91cf\u7ea7&#xff08;\u6570\u636e\u6e90&#xff1a;simdjson \u5b98\u65b9 README \u53ca\u8bba\u6587&#xff0c;Intel Skylake \/ Apple M1 \u7b49\u73b0\u4ee3 CPU&#xff09;&#xff1a;<\/p>\n<table>\n<tbody>\n<tr>\u89e3\u6790\u5668\u5927\u81f4\u541e\u5410&#xff08;4GHz x86&#xff09;\u8bf4\u660e<\/tr>\n<tr>\n<td>simdjson&#xff08;AVX2&#xff09;<\/td>\n<td>2.5 ~ 3.5 GB\/s<\/td>\n<td>\u5b98\u65b9\u57fa\u51c6 Twitter JSON \u6570\u636e\u96c6<\/td>\n<\/tr>\n<tr>\n<td>RapidJSON&#xff08;\u666e\u901a\u6a21\u5f0f&#xff09;<\/td>\n<td>~300 MB\/s<\/td>\n<td>\u8001\u724c\u9ad8\u6027\u80fd\u5e93&#xff0c;SIMD \u652f\u6301\u6709\u9650<\/td>\n<\/tr>\n<tr>\n<td>nlohmann\/json<\/td>\n<td>~100 ~ 200 MB\/s<\/td>\n<td>\u6613\u7528\u6027\u738b\u8005&#xff0c;\u6027\u80fd\u4e00\u822c<\/td>\n<\/tr>\n<tr>\n<td>\u5404\u8bed\u8a00\u6807\u51c6\u5e93 JSON<\/td>\n<td>\u901a\u5e38 &lt; 500 MB\/s<\/td>\n<td>\u542b Python\/JS \u7b49\u89e3\u91ca\u578b\u5b9e\u73b0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6362\u7b97\u6210\u4e1a\u52a1\u8bed\u8a00&#xff1a;1GB \u7684 JSON \u65e5\u5fd7&#xff0c;simdjson \u5927\u7ea6 0.3~0.4 \u79d2\u89e3\u6790\u5b8c&#xff0c;\u800c nlohmann\/json \u9700\u8981 5~10 \u79d2\u3002\u8fd9\u5c31\u662f&#034;GB\/s \u7ea7&#034;\u7684\u542b\u4e49\u2014\u2014\u4e0d\u662f&#034;\u80fd\u89e3\u6790 GB \u5927\u5c0f\u7684\u6587\u4ef6&#034;&#xff0c;\u800c\u662f&#034;\u89e3\u6790\u901f\u5ea6\u4ee5 GB\/s \u8ba1&#034;\u3002<\/p>\n<p>\u6027\u80fd\u8fd8\u4f53\u73b0\u5728\u5185\u5b58\u5206\u914d\u6781\u5c11&#xff1a;simdjson \u89e3\u6790\u8fc7\u7a0b\u51e0\u4e4e\u4e0d\u4ea7\u751f\u4e34\u65f6\u5b57\u7b26\u4e32\u62f7\u8d1d&#xff08;\u89c1\u4e0b\u4e00\u6761&#xff09;&#xff0c;\u5927\u5e45\u51cf\u5c11 malloc\/free \u548c cache miss\u3002<\/p>\n<h4 id=\"33-\u4f18\u70b9\u4e09\u96f6\u62f7\u8d1d-\u60f0\u6027\u89e3\u6790\u53ea\u770b\u4e0d\u642c\">3.3 \u4f18\u70b9\u4e09&#xff1a;\u96f6\u62f7\u8d1d &#043; \u60f0\u6027\u89e3\u6790\u2014\u2014\u53ea\u770b\u4e0d\u642c<\/h4>\n<p>\u8fd9\u662f simdjson \u548c\u4f20\u7edf DOM \u5e93\u6700\u672c\u8d28\u7684\u8bbe\u8ba1\u5dee\u5f02&#xff0c;\u5206\u4e24\u70b9&#xff1a;<\/p>\n<h5 id=\"1-\u96f6\u62f7\u8d1dzero-copy\u89c6\u56fe\">1) \u96f6\u62f7\u8d1d&#xff08;zero-copy&#xff09;\u89c6\u56fe<\/h5>\n<p>\u4f20\u7edf DOM \u89e3\u6790\u5668&#xff08;\u5982 nlohmann\/json&#xff09;\u4f1a\u590d\u5236\u6570\u636e&#xff1a;\u628a JSON \u91cc\u7684\u5b57\u7b26\u4e32\u00a0&#034;name&#034;: &#034;Alice&#034;\u00a0\u590d\u5236\u8fdb\u4e00\u4e2a\u65b0\u7684\u00a0std::string\u00a0\u5bf9\u8c61&#xff0c;\u5efa\u4e00\u68f5\u5b8c\u5168\u72ec\u7acb\u4e8e\u539f\u59cb\u6587\u672c\u7684\u5bf9\u8c61\u6811\u3002<\/p>\n<p>simdjson \u4e0d\u8fd9\u4e48\u505a&#xff1a;\u5b83\u89e3\u6790\u51fa\u7684\u00a0dom::element\u00a0\u53ea\u662f\u6307\u5411\u539f\u59cb\u7f13\u51b2\u533a\u7684&#034;\u89c6\u56fe&#034;&#xff08;\u76f8\u5f53\u4e8e\u7ed9\u539f\u59cb\u6587\u672c\u8d34\u4e86\u4e2a\u6807\u7b7e&#xff1a;\u8fd9\u91cc\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u3001\u90a3\u91cc\u662f\u4e00\u4e2a\u6570\u5b57&#xff09;\u3002\u53d6\u503c\u65f6\u5b83\u8fd4\u56de\u00a0std::string_view\u2014\u2014\u4e00\u4e2a&#034;\u770b\u5f97\u5230\u8fd9\u6bb5\u6587\u672c\u4f46\u4e0d\u62e5\u6709\u5b83&#034;\u7684\u8f7b\u91cf\u6307\u9488&#043;\u957f\u5ea6\u3002<\/p>\n<p>\u597d\u5904&#xff1a;<\/p>\n<ul>\n<li>\u89e3\u6790\u8fc7\u7a0b\u51e0\u4e4e\u4e0d\u5206\u914d\u5185\u5b58&#xff1b;<\/li>\n<li>\u53d6\u5b57\u7b26\u4e32\u96f6\u62f7\u8d1d&#xff0c;\u76f4\u63a5\u770b\u539f\u59cb\u7f13\u51b2\u533a\u3002<\/li>\n<\/ul>\n<p>\u4ee3\u4ef7&#xff08;\u26a0\ufe0f \u6613\u9519\u70b9&#xff09;&#xff1a;\u539f\u59cb JSON \u7f13\u51b2\u533a\u5fc5\u987b\u6d3b\u5f97\u6bd4\u89e3\u6790\u7ed3\u679c\u4e45\u3002\u5982\u679c\u4f60\u628a JSON \u5b57\u7b26\u4e32\u5c40\u90e8\u53d8\u91cf\u9500\u6bc1\u4e86\u518d\u53bb\u8bfb\u7ed3\u679c&#xff0c;\u5c31\u662f\u60ac\u7a7a\u5f15\u7528&#xff08;use-after-free&#xff09;\u3002<\/p>\n<h5 id=\"2-\u60f0\u6027\u89e3\u6790on-demand\u6309\u9700\u60f0\u6027\u53d6\u503c\">2) \u60f0\u6027\u89e3\u6790&#xff08;on-demand&#xff0c;\u6309\u9700\u60f0\u6027\u53d6\u503c&#xff09;<\/h5>\n<p>v2.0 \u8d77\u5f15\u5165\u7684 on-demand API \u66f4\u8fdb\u4e00\u6b65&#xff1a;\u4f60\u53d6\u54ea\u4e2a\u5b57\u6bb5&#xff0c;\u5b83\u624d\u89e3\u6790\u54ea\u4e2a\u5b57\u6bb5&#xff0c;\u800c\u4e0d\u662f\u628a\u6574\u68f5 JSON \u6811\u5148\u5efa\u597d\u3002<\/p>\n<p>\u7c7b\u6bd4&#xff1a;\u6574\u68f5 JSON \u662f\u4e00\u680b\u5927\u697c&#xff0c;DOM API \u662f&#034;\u5148\u628a\u6574\u680b\u697c\u7684\u623f\u95f4\u94a5\u5319\u5168\u90e8\u914d\u597d\u7ed9\u4f60&#034;&#xff1b;on-demand \u662f&#034;\u4f60\u8d70\u5230\u54ea\u4e2a\u623f\u95f4\u95e8\u53e3&#xff0c;\u624d\u73b0\u573a\u5f00\u90a3\u628a\u9501&#034;\u3002\u5982\u679c\u4f60\u53ea\u9700\u8981 100 \u4e2a\u5b57\u6bb5\u91cc\u7684 2 \u4e2a&#xff0c;on-demand \u80fd\u7701\u6389\u5927\u7ea6 90% \u7684\u89e3\u6790\u5de5\u4f5c\u91cf\u3002<\/p>\n<h4 id=\"34-\u4f18\u70b9\u56db\u6613\u7528-api\u7b80\u5355\u5230\u50cf\u8bfb\u5b57\u5178\">3.4 \u4f18\u70b9\u56db&#xff1a;\u6613\u7528 API\u2014\u2014\u7b80\u5355\u5230\u50cf\u8bfb\u5b57\u5178<\/h4>\n<p>\u867d\u7136\u5e95\u5c42\u7528 SIMD \u5f88&#034;\u786c\u6838&#034;&#xff0c;\u4f46\u5bf9\u5916 API \u975e\u5e38\u53cb\u597d&#xff0c;\u4e24\u884c\u5c31\u80fd\u89e3\u6790&#xff1a;<\/p>\n<p>simdjson::dom::parser parser;                       \/\/ \u521b\u5efa\u4e00\u4e2a\u89e3\u6790\u5668&#xff08;\u53ef\u590d\u7528&#xff09;<br \/>\nsimdjson::dom::element doc &#061; parser.parse(json);    \/\/ \u89e3\u6790 JSON&#xff0c;\u5f97\u5230\u6839\u5143\u7d20<br \/>\nstd::string_view name &#061; doc[&#034;name&#034;];                \/\/ \u50cf\u5b57\u5178\u4e00\u6837\u53d6\u503c<\/p>\n<p>\u914d\u5408\u00a0simdjson_result&#xff08;\u5e26\u9519\u8bef\u7801\u7684\u7ed3\u679c\u7c7b\u578b&#xff09;&#xff0c;\u51fa\u9519\u65f6\u4e0d\u7528\u6355\u83b7\u5f02\u5e38&#xff0c;\u76f4\u63a5\u00a0if (!result) { &#8230; }\u00a0\u5224\u65ad\u5373\u53ef&#xff0c;\u65e2\u5b89\u5168\u53c8\u9ad8\u6548\u3002<\/p>\n<h4 id=\"35-\u4e0e-nlohmannjson-\u7684\u5bf9\u6bd4\u8868\u683c\">3.5 \u4e0e nlohmann\/json \u7684\u5bf9\u6bd4\u8868\u683c<\/h4>\n<table>\n<tbody>\n<tr>\u7ef4\u5ea6simdjsonnlohmann\/json<\/tr>\n<tr>\n<td>\u5b9a\u4f4d<\/td>\n<td>\u6781\u81f4\u6027\u80fd\u7684\u53ea\u8bfb\u89e3\u6790\u5668<\/td>\n<td>\u901a\u7528\u6613\u7528\u3001\u529f\u80fd\u5168\u9762\u7684 JSON \u5e93<\/td>\n<\/tr>\n<tr>\n<td>\u89e3\u6790\u901f\u5ea6<\/td>\n<td>GB\/s \u7ea7&#xff08;\u5feb 10~50 \u500d&#xff09;<\/td>\n<td>100~200 MB\/s \u91cf\u7ea7<\/td>\n<\/tr>\n<tr>\n<td>\u5e95\u5c42\u6280\u672f<\/td>\n<td>SIMD&#xff08;AVX2\/AVX-512\/NEON&#xff09;&#043; \u96f6\u62f7\u8d1d\u89c6\u56fe<\/td>\n<td>\u4f20\u7edf\u9010\u5b57\u7b26 &#043; \u5185\u5b58\u590d\u5236\u5efa\u6811<\/td>\n<\/tr>\n<tr>\n<td>\u5b57\u7b26\u4e32\u53d6\u503c<\/td>\n<td>std::string_view&#xff08;\u96f6\u62f7\u8d1d&#xff09;<\/td>\n<td>std::string&#xff08;\u590d\u5236&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u60f0\u6027\u89e3\u6790<\/td>\n<td>\u2705 on-demand API \u6309\u9700\u89e3\u6790<\/td>\n<td>\u274c \u5fc5\u987b\u6574\u4f53\u5efa DOM \u6811<\/td>\n<\/tr>\n<tr>\n<td>\u4fee\u6539\/\u751f\u6210 JSON<\/td>\n<td>\u274c \u53ea\u8bfb&#xff08;\u53ef minify&#xff0c;\u4e0d\u80fd\u6539\u6811&#xff09;<\/td>\n<td>\u2705 \u652f\u6301\u589e\u5220\u6539\u67e5\u3001\u5e8f\u5217\u5316\u8f93\u51fa<\/td>\n<\/tr>\n<tr>\n<td>\u4efb\u610f\u7cbe\u5ea6\/\u81ea\u5b9a\u4e49\u7c7b\u578b<\/td>\n<td>\u274c \u6709\u9650<\/td>\n<td>\u2705 \u652f\u6301\u81ea\u5b9a\u4e49\u7c7b\u578b\u8f6c\u6362<\/td>\n<\/tr>\n<tr>\n<td>\u9519\u8bef\u5904\u7406<\/td>\n<td>\u9519\u8bef\u7801\u00a0simdjson_result&#xff08;\u53ef\u9009\u5f02\u5e38&#xff09;<\/td>\n<td>\u9ed8\u8ba4\u629b\u5f02\u5e38<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u6240\u6709\u6743\u8981\u6c42<\/td>\n<td>\u26a0\ufe0f \u539f\u59cb\u7f13\u51b2\u533a\u987b\u957f\u4e8e\u7ed3\u679c<\/td>\n<td>\u4e0d\u8981\u6c42&#xff08;\u6570\u636e\u5df2\u590d\u5236&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5b66\u4e60\u6210\u672c<\/td>\n<td>\u4e2d&#xff08;\u9700\u7406\u89e3\u89c6\u56fe\u751f\u547d\u5468\u671f&#xff09;<\/td>\n<td>\u4f4e&#xff08;\u4e0a\u624b\u6781\u5feb&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u9ad8\u9891\u8bfb\u3001\u5927\u541e\u5410\u3001\u65e5\u5fd7\/\u7f51\u5173\/\u7ba1\u9053<\/td>\n<td>\u901a\u7528\u4e1a\u52a1\u3001CRUD\u3001\u9700\u8981\u5199 JSON \u7684\u573a\u666f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7ed3\u8bba\u4e00\u53e5\u8bdd&#xff1a;\u53ea\u8bfb\u3001\u91cf\u5927\u3001\u8ffd\u6c42\u541e\u5410 \u2192 simdjson&#xff1b;\u8981\u5199\u3001\u8981\u6539\u3001\u56fe\u7701\u4e8b \u2192 nlohmann\/json\u3002\u4e24\u8005\u4e5f\u53ef\u4ee5\u6df7\u7528&#xff1a;simdjson \u8bfb\u51fa\u6765&#xff0c;\u8f6c\u6210 nlohmann \u5bf9\u8c61\u518d\u5f80\u4e1a\u52a1\u5c42\u4f20\u3002<\/p>\n<hr \/>\n<h3 id=\"4-\u5178\u578b\u4f7f\u7528\u573a\u666f\u54ea\u4e9b\u9879\u76ee\u5e94\u8be5\u9009\u5b83\">4. \u5178\u578b\u4f7f\u7528\u573a\u666f&#xff1a;\u54ea\u4e9b\u9879\u76ee\u5e94\u8be5\u9009\u5b83<\/h3>\n<table>\n<tbody>\n<tr>\u573a\u666f\u4e3a\u4ec0\u4e48\u9002\u5408 simdjson\u5178\u578b\u5f62\u6001<\/tr>\n<tr>\n<td>\u65e5\u5fd7\u5206\u6790<\/td>\n<td>\u6d77\u91cf NDJSON&#xff08;\u6bcf\u884c\u4e00\u6761 JSON&#xff09;\u6301\u7eed\u704c\u5165&#xff0c;parse_many \u6d41\u5f0f\u5904\u7406&#xff0c;\u541e\u5410\u51b3\u5b9a\u4e00\u5207<\/td>\n<td>\u65e5\u5fd7\u91c7\u96c6\u3001ELK \u524d\u7f6e\u89e3\u6790\u3001\u544a\u8b66\u89c4\u5219\u5339\u914d<\/td>\n<\/tr>\n<tr>\n<td>\u5927\u6570\u636e\u7ba1\u9053&#xff08;ETL&#xff09;<\/td>\n<td>\u6bcf\u6279\u51e0 GB JSON \u8981\u5feb\u901f\u6e05\u6d17\u3001\u63d0\u53d6\u5b57\u6bb5\u3001\u5199\u5165\u4e0b\u6e38<\/td>\n<td>\u6570\u636e\u6e56\u5165\u6e56\u3001\u5b9e\u65f6\u6570\u4ed3\u3001\u7279\u5f81\u63d0\u53d6<\/td>\n<\/tr>\n<tr>\n<td>API \u7f51\u5173 \/ \u53cd\u5411\u4ee3\u7406<\/td>\n<td>\u6bcf\u4e2a\u8bf7\u6c42\u90fd\u8981\u89e3\u6790 JSON \u505a\u8def\u7531\/\u9274\u6743\/\u9650\u6d41&#xff0c;\u89e3\u6790\u65f6\u95f4\u662f\u5173\u952e\u5ef6\u8fdf<\/td>\n<td>\u7f51\u5173\u4e2d\u95f4\u4ef6\u3001BFF \u5c42\u3001\u8bf7\u6c42\u6539\u5199<\/td>\n<\/tr>\n<tr>\n<td>\u5b9e\u65f6\u6570\u636e\u6d41<\/td>\n<td>\u884c\u60c5\u3001IoT \u9065\u6d4b\u3001\u76d1\u63a7\u6307\u6807&#xff0c;\u6bcf\u79d2\u6210\u5343\u4e0a\u4e07\u6761 JSON<\/td>\n<td>\u884c\u60c5\u63a8\u9001\u3001\u8bbe\u5907\u4e0a\u62a5\u3001\u6307\u6807\u805a\u5408<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5e93\/\u7f13\u5b58\u5c42<\/td>\n<td>\u5b58\u50a8\u5f15\u64ce\u5185\u90e8\u8981\u628a JSON \u5f53&#034;\u53ef\u67e5\u8be2\u6587\u6863&#034;&#xff0c;\u8bfb\u591a\u5199\u5c11<\/td>\n<td>\u6587\u6863\u578b\u6269\u5c55\u3001JSONB \u524d\u7f6e\u89e3\u6790<\/td>\n<\/tr>\n<tr>\n<td>\u684c\u9762\/\u5d4c\u5165\u5f0f\u5de5\u5177<\/td>\n<td>\u53ea\u9700\u5feb\u901f\u8bfb\u53d6\u914d\u7f6e\u6216\u6570\u636e\u6587\u4ef6&#xff0c;\u5e0c\u671b\u96f6\u62f7\u8d1d\u7701\u5185\u5b58<\/td>\n<td>\u914d\u7f6e\u6587\u4ef6\u89e3\u6790\u3001\u79bb\u7ebf\u5206\u6790\u5de5\u5177<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0d\u9002\u5408&#xff1a;\u9700\u8981\u9891\u7e41\u4fee\u6539 JSON \u7ed3\u6784\u3001\u9700\u8981\u628a\u5bf9\u8c61\u91cd\u65b0\u5e8f\u5217\u5316\u6210 JSON \u8f93\u51fa\u3001\u89e3\u6790\u6b21\u6570\u5f88\u5c11\u800c\u5f00\u53d1\u6548\u7387\u4f18\u5148\u7684\u5c0f\u5de5\u5177\u2014\u2014\u8fd9\u4e9b\u8bf7\u7ee7\u7eed\u7528 nlohmann\/json \u6216 RapidJSON\u3002<\/p>\n<hr \/>\n<h3 id=\"5-\u5feb\u901f\u4e0a\u624b\u4ece\u96f6\u5230\u8dd1\u901a\u5206\u6b65\u6559\u7a0b\">5. \u5feb\u901f\u4e0a\u624b&#xff1a;\u4ece\u96f6\u5230\u8dd1\u901a&#xff08;\u5206\u6b65\u6559\u7a0b&#xff09;<\/h3>\n<h4 id=\"\u7b2c-1-\u6b65\u51c6\u5907\u7f16\u8bd1\u73af\u5883\">\u7b2c 1 \u6b65&#xff1a;\u51c6\u5907\u7f16\u8bd1\u73af\u5883<\/h4>\n<ul>\n<li>\u7f16\u8bd1\u5668&#xff1a;\u652f\u6301 C&#043;&#043;17 \u7684 GCC 7&#043; \/ Clang 5&#043; \/ MSVC 2019&#043;&#xff08;Windows \u5efa\u8bae VS2019 \u6216\u66f4\u9ad8&#xff09;\u3002<\/li>\n<li>CMake&#xff1a;3.15&#043;\u3002<\/li>\n<li>CPU&#xff1a;\u65e0\u9700\u624b\u52a8\u5f00\u542f SIMD&#xff01;simdjson \u9ed8\u8ba4\u8fd0\u884c\u65f6\u81ea\u52a8\u68c0\u6d4b&#xff08;runtime dispatch&#xff09;&#xff0c;\u5728\u652f\u6301 AVX2\/NEON \u7684\u673a\u5668\u4e0a\u81ea\u52a8\u7528\u6700\u5feb\u8def\u5f84&#xff1b;\u5f53\u7136&#xff0c;\u60f3\u69a8\u5e72\u6027\u80fd\u4e5f\u53ef\u4ee5\u7f16\u8bd1\u671f\u6307\u5b9a\u00a0-march&#061;native&#xff08;\u89c1\u7b2c 7 \u8282&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u26a0\ufe0f \u4e0d\u9700\u8981\u624b\u52a8\u00a0#include &lt;immintrin.h&gt;\u00a0\u6216\u5199\u4efb\u4f55 SIMD \u4ee3\u7801&#xff0c;\u5e93\u5185\u90e8\u5df2\u5c01\u88c5\u597d\u3002<\/p>\n<h4 id=\"\u7b2c-2-\u6b65\u7528-cmake-\u96c6\u6210-simdjson\">\u7b2c 2 \u6b65&#xff1a;\u7528 CMake \u96c6\u6210 simdjson<\/h4>\n<p>\u63a8\u8350\u00a0FetchContent\u00a0\u65b9\u5f0f&#xff0c;\u4e00\u6761\u547d\u4ee4\u62c9\u53d6\u5e76\u7f16\u8bd1&#xff08;\u65e0\u9700\u63d0\u524d\u5b89\u88c5&#xff09;&#xff1a;<\/p>\n<p>cmake_minimum_required(VERSION 3.15)<br \/>\nproject(simdjson_demo CXX)<\/p>\n<p>set(CMAKE_CXX_STANDARD 17)<br \/>\nset(CMAKE_CXX_STANDARD_REQUIRED ON)<\/p>\n<p># 1. \u4ece GitHub \u62c9\u53d6 simdjson \u6e90\u7801&#xff08;\u53ef\u6362\u6210 tag \u6216 commit \u56fa\u5b9a\u7248\u672c&#xff09;<br \/>\ninclude(FetchContent)<br \/>\nFetchContent_Declare(<br \/>\n  simdjson<br \/>\n  GIT_REPOSITORY https:\/\/github.com\/simdjson\/simdjson.git<br \/>\n  GIT_TAG        v3.12.0          # \u5efa\u8bae\u56fa\u5b9a\u7248\u672c&#xff0c;\u907f\u514d\u4e0a\u6e38\u53d8\u52a8<br \/>\n)<br \/>\nFetchContent_MakeAvailable(simdjson)<\/p>\n<p>add_executable(simdjson_demo main.cpp)<\/p>\n<p># 2. \u94fe\u63a5 simdjson&#xff08;CMake \u4f1a\u81ea\u52a8\u5904\u7406\u7f16\u8bd1\u53c2\u6570\u4e0e\u8fd0\u884c\u65f6\u5206\u53d1&#xff09;<br \/>\ntarget_link_libraries(simdjson_demo PRIVATE simdjson)<\/p>\n<p>\u5982\u679c\u4f60\u5df2\u901a\u8fc7\u5305\u7ba1\u7406\u5668&#xff08;vcpkg \/ Conan&#xff09;\u6216\u7cfb\u7edf\u5b89\u88c5 simdjson&#xff0c;\u4e5f\u53ef\u4ee5\u7528\u66f4\u8f7b\u91cf\u7684\u65b9\u5f0f&#xff1a;<\/p>\n<p>find_package(simdjson REQUIRED)<br \/>\ntarget_link_libraries(simdjson_demo PRIVATE simdjson::simdjson)<\/p>\n<h4 id=\"\u7b2c-3-\u6b65\u5199\u7b2c\u4e00\u6bb5\u89e3\u6790\u4ee3\u7801\">\u7b2c 3 \u6b65&#xff1a;\u5199\u7b2c\u4e00\u6bb5\u89e3\u6790\u4ee3\u7801<\/h4>\n<p>\u521b\u5efa\u00a0main.cpp&#xff1a;<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;simdjson.h&gt;        \/\/ \u53ea\u9700\u5305\u542b\u8fd9\u4e00\u4e2a\u5934\u6587\u4ef6<\/p>\n<p>int main() {<br \/>\n    \/\/ 1. \u51c6\u5907\u4e00\u6bb5 JSON \u6587\u672c&#xff08;\u6ce8\u610f&#xff1a;simdjson \u8981\u6c42\u8f93\u5165\u662f\u5b8c\u6574\u5408\u6cd5\u7684 JSON&#xff09;<br \/>\n    std::string json &#061; R&#034;({<br \/>\n        &#034;service&#034;: &#034;auth&#034;,<br \/>\n        &#034;status&#034;: &#034;ok&#034;,<br \/>\n        &#034;latency_ms&#034;: 12<br \/>\n    })&#034;;<\/p>\n<p>    \/\/ 2. \u521b\u5efa\u89e3\u6790\u5668&#xff08;\u53ef\u590d\u7528&#xff0c;\u4e0d\u8981\u6bcf\u89e3\u6790\u4e00\u6b21\u5c31\u65b0\u5efa&#xff09;<br \/>\n    simdjson::dom::parser parser;<\/p>\n<p>    \/\/ 3. \u89e3\u6790&#xff01;parser.parse \u8fd4\u56de simdjson_result&#xff0c;\u53ef\u76f4\u63a5\u5f53 bool \u5224\u65ad<br \/>\n    simdjson::dom::element doc &#061; parser.parse(json);<br \/>\n    if (doc.error()) {                          \/\/ \u51fa\u9519\u65f6 error() \u8fd4\u56de\u9519\u8bef\u7801\u5bf9\u8c61<br \/>\n        std::cerr &lt;&lt; &#034;\u89e3\u6790\u5931\u8d25: &#034; &lt;&lt; simdjson::error_message(doc.error()) &lt;&lt; std::endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    \/\/ 4. \u50cf\u5b57\u5178\u4e00\u6837\u53d6\u503c&#xff1a;operator[] \u652f\u6301\u6574\u6570\u4e0b\u6807\u548c\u5b57\u7b26\u4e32\u952e<br \/>\n    std::string_view service &#061; doc[&#034;service&#034;];   \/\/ \u8fd4\u56de string_view&#xff08;\u96f6\u62f7\u8d1d&#xff01;&#xff09;<br \/>\n    std::string_view status  &#061; doc[&#034;status&#034;];<br \/>\n    int64_t latency &#061; doc[&#034;latency_ms&#034;];         \/\/ \u6570\u5b57\u53ef\u9690\u5f0f\u8f6c\u6362\u4e3a int64_t<\/p>\n<p>    \/\/ 5. \u8f93\u51fa<br \/>\n    std::cout &lt;&lt; &#034;service  &#061; &#034; &lt;&lt; service &lt;&lt; std::endl;<br \/>\n    std::cout &lt;&lt; &#034;status   &#061; &#034; &lt;&lt; status  &lt;&lt; std::endl;<br \/>\n    std::cout &lt;&lt; &#034;latency  &#061; &#034; &lt;&lt; latency &lt;&lt; &#034; ms&#034; &lt;&lt; std::endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4 id=\"\u7b2c-4-\u6b65\u7f16\u8bd1\u5e76\u8fd0\u884c\">\u7b2c 4 \u6b65&#xff1a;\u7f16\u8bd1\u5e76\u8fd0\u884c<\/h4>\n<p># \u5728 CMake \u5de5\u7a0b\u6839\u76ee\u5f55<br \/>\ncmake -B build -DCMAKE_BUILD_TYPE&#061;Release<br \/>\ncmake &#8211;build build &#8211;config Release<br \/>\n.\/build\/simdjson_demo<\/p>\n<p>\u9884\u671f\u8f93\u51fa&#xff1a;<\/p>\n<p> service  &#061; auth<br \/>\nstatus   &#061; ok<br \/>\nlatency  &#061; 12 ms<\/p>\n<p>\u26a0\ufe0f\u00a0\u5fc5\u987b\u7528 Release \u6a21\u5f0f&#xff01;Debug \u6a21\u5f0f&#xff08;-O0&#xff09;\u4e0b SIMD \u5185\u8054\u4f18\u5316\u88ab\u5173\u95ed&#xff0c;\u6027\u80fd\u4f1a\u9000\u5316\u5230\u548c\u666e\u901a\u5e93\u5dee\u4e0d\u591a&#xff0c;\u751a\u81f3\u66f4\u6162\u3002<\/p>\n<hr \/>\n<h3 id=\"6-\u6838\u5fc3\u7528\u6cd5\u8be6\u89e3\u53ef\u8fd0\u884c\u4ee3\u7801\">6. \u6838\u5fc3\u7528\u6cd5\u8be6\u89e3&#xff08;\u53ef\u8fd0\u884c\u4ee3\u7801&#xff09;<\/h3>\n<p>\u4e0b\u9762\u6bcf\u4e2a\u5c0f\u8282\u90fd\u7ed9\u51fa\u53ef\u76f4\u63a5\u8fd0\u884c\u7684\u793a\u4f8b\u3002\u4e3a\u8282\u7ea6\u7bc7\u5e45&#xff0c;\u793a\u4f8b\u5171\u7528\u540c\u4e00\u4e2a\u89e3\u6790\u5668\u58f0\u660e&#xff0c;\u5b9e\u9645\u4f7f\u7528\u65f6\u8bf7\u628a\u4ee3\u7801\u653e\u8fdb\u540c\u4e00\u4e2a\u6587\u4ef6\u6216\u6309\u9700\u5408\u5e76\u3002<\/p>\n<h4 id=\"61-dom-api\u4f20\u7edf\u7684\u4e00\u6b21\u6027\u89e3\u6790\">6.1 DOM API&#xff1a;\u4f20\u7edf\u7684\u4e00\u6b21\u6027\u89e3\u6790<\/h4>\n<p>DOM&#xff08;Document Object Model&#xff0c;\u6587\u6863\u5bf9\u8c61\u6a21\u578b&#xff09;\u662f&#034;\u5148\u628a\u6574\u68f5\u6811\u5efa\u597d&#xff0c;\u518d\u968f\u4fbf\u67e5&#034;\u7684\u7ecf\u5178\u6a21\u5f0f\u3002\u9002\u5408\u540c\u4e00\u4efd JSON \u4f1a\u88ab\u53cd\u590d\u8bfb\u53d6\u591a\u6b21\u7684\u573a\u666f\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;simdjson.h&gt;<\/p>\n<p>int main() {<br \/>\n    std::string json &#061; R&#034;({<br \/>\n        &#034;users&#034;: [<br \/>\n            {&#034;id&#034;: 1, &#034;name&#034;: &#034;Alice&#034;, &#034;tags&#034;: [&#034;admin&#034;, &#034;c&#043;&#043;&#034;]},<br \/>\n            {&#034;id&#034;: 2, &#034;name&#034;: &#034;Bob&#034;,   &#034;tags&#034;: [&#034;dev&#034;]}<br \/>\n        ],<br \/>\n        &#034;total&#034;: 2<br \/>\n    })&#034;;<\/p>\n<p>    simdjson::dom::parser parser;<br \/>\n    simdjson::dom::element doc &#061; parser.parse(json);<br \/>\n    if (doc.error()) {<br \/>\n        std::cerr &lt;&lt; &#034;\u89e3\u6790\u5931\u8d25: &#034; &lt;&lt; simdjson::error_message(doc.error()) &lt;&lt; std::endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    \/\/ 1. \u53d6\u6570\u7ec4<br \/>\n    simdjson::dom::array users &#061; doc[&#034;users&#034;];<\/p>\n<p>    \/\/ 2. \u904d\u5386\u6570\u7ec4&#xff0c;\u53d6\u6bcf\u4e2a\u5bf9\u8c61\u7684\u5b57\u6bb5<br \/>\n    for (simdjson::dom::element user : users) {<br \/>\n        int64_t id   &#061; user[&#034;id&#034;];<br \/>\n        std::string_view name &#061; user[&#034;name&#034;];<br \/>\n        std::cout &lt;&lt; &#034;id&#061;&#034; &lt;&lt; id &lt;&lt; &#034;, name&#061;&#034; &lt;&lt; name &lt;&lt; std::endl;<\/p>\n<p>        \/\/ 3. \u5d4c\u5957\u6570\u7ec4<br \/>\n        simdjson::dom::array tags &#061; user[&#034;tags&#034;];<br \/>\n        for (std::string_view tag : tags) {   \/\/ \u6570\u7ec4\u5143\u7d20\u662f\u5b57\u7b26\u4e32&#xff0c;\u53ef\u76f4\u63a5\u8f6c string_view<br \/>\n            std::cout &lt;&lt; &#034;    tag: &#034; &lt;&lt; tag &lt;&lt; std::endl;<br \/>\n        }<br \/>\n    }<\/p>\n<p>    \/\/ 4. \u53d6\u6839\u5bf9\u8c61\u7684\u53e6\u4e00\u4e2a\u5b57\u6bb5<br \/>\n    std::cout &lt;&lt; &#034;total&#061;&#034; &lt;&lt; doc[&#034;total&#034;].get_int64() &lt;&lt; std::endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u5173\u952e API \u901f\u67e5&#xff1a;<\/p>\n<table>\n<tbody>\n<tr>\u8868\u8fbe\u5f0f\u542b\u4e49<\/tr>\n<tr>\n<td>parser.parse(json)<\/td>\n<td>\u89e3\u6790 JSON&#xff0c;\u8fd4\u56de\u6839\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td>doc[&#034;key&#034;]<\/td>\n<td>\u6309\u5b57\u7b26\u4e32\u952e\u53d6\u503c<\/td>\n<\/tr>\n<tr>\n<td>arr.at(0)\u00a0\/\u00a0arr[i]<\/td>\n<td>\u6309\u4e0b\u6807\u53d6\u6570\u7ec4\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td>element.get_int64()\u00a0\/\u00a0get_double()<\/td>\n<td>\u663e\u5f0f\u53d6\u6570\u5b57<\/td>\n<\/tr>\n<tr>\n<td>element.get_string()<\/td>\n<td>\u663e\u5f0f\u53d6\u5b57\u7b26\u4e32&#xff08;\u8fd4\u56de\u00a0std::string_view&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>element.is_object() \/ is_array() \/ is_null()<\/td>\n<td>\u7c7b\u578b\u5224\u65ad<\/td>\n<\/tr>\n<tr>\n<td>element[&#034;a&#034;][&#034;b&#034;]<\/td>\n<td>\u94fe\u5f0f\u53d6\u5d4c\u5957\u5b57\u6bb5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"62-on-demand\u6309\u9700\u60f0\u6027\u53d6\u503c\">6.2 on-demand&#xff1a;\u6309\u9700\u60f0\u6027\u53d6\u503c<\/h4>\n<p>on-demand&#xff08;\u6309\u9700\u60f0\u6027&#xff09;\u662f simdjson \u5b98\u65b9\u63a8\u8350\u7684\u9ed8\u8ba4\u8def\u5f84&#xff1a;\u8bbf\u95ee\u5230\u54ea\u4e2a\u5b57\u6bb5&#xff0c;\u624d\u89e3\u6790\u54ea\u4e2a\u5b57\u6bb5\u3002\u9002\u5408&#034;JSON \u5f88\u5927&#xff0c;\u4f46\u6211\u53ea\u5173\u5fc3\u5176\u4e2d\u51e0\u4e2a\u5b57\u6bb5&#034;\u7684\u573a\u666f\u3002<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;simdjson.h&gt;<\/p>\n<p>int main() {<br \/>\n    std::string json &#061; R&#034;({<br \/>\n        &#034;header&#034;: {&#034;request_id&#034;: &#034;abc-123&#034;, &#034;timestamp&#034;: 1723000000},<br \/>\n        &#034;payload&#034;: {&#034;data&#034;: &#034;\u8fd9\u91cc\u6709\u4e00\u5927\u5806\u7528\u4e0d\u5230\u7684\u6570\u636e&#8230;&#034;}<br \/>\n    })&#034;;<\/p>\n<p>    \/\/ on-demand \u4f7f\u7528\u72ec\u7acb\u7684\u89e3\u6790\u5668\u7c7b\u578b<br \/>\n    simdjson::ondemand::parser parser;<\/p>\n<p>    \/\/ iterate() \u4e0d\u662f\u7acb\u5373\u89e3\u6790&#xff0c;\u800c\u662f\u521b\u5efa\u4e00\u4e2a\u60f0\u6027\u8fed\u4ee3\u5668&#xff08;JSON \u6570\u636e\u9700\u5b58\u6d3b\u5230\u8bfb\u53d6\u5b8c\u6210&#xff09;<br \/>\n    simdjson::ondemand::document doc &#061; parser.iterate(json);<br \/>\n    if (doc.error()) {<br \/>\n        std::cerr &lt;&lt; &#034;\u89e3\u6790\u5931\u8d25: &#034; &lt;&lt; simdjson::error_message(doc.error()) &lt;&lt; std::endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    \/\/ \u53ea\u53d6\u6211\u4eec\u5173\u5fc3\u7684\u5b57\u6bb5\u2014\u2014\u5176\u4f59\u90e8\u5206&#xff08;payload&#xff09;\u6839\u672c\u4e0d\u4f1a\u88ab\u89e3\u6790<br \/>\n    std::string_view request_id &#061; doc[&#034;header&#034;][&#034;request_id&#034;];<br \/>\n    int64_t ts &#061; doc[&#034;header&#034;][&#034;timestamp&#034;];<\/p>\n<p>    std::cout &lt;&lt; &#034;request_id&#061;&#034; &lt;&lt; request_id &lt;&lt; std::endl;<br \/>\n    std::cout &lt;&lt; &#034;timestamp &#061;&#034; &lt;&lt; ts &lt;&lt; std::endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u26a0\ufe0f on-demand \u662f\u5355\u904d\u8bfb\u53d6\u6a21\u578b&#xff1a;\u540c\u4e00\u8def\u5f84\u7684\u00a0doc[&#034;header&#034;]\u00a0\u4e0d\u80fd\u53cd\u590d\u53d6&#xff08;\u9664\u975e\u91cd\u65b0 iterate&#xff09;\u3002\u5982\u679c\u9700\u8981\u53cd\u590d\u8bfb&#xff0c;\u8bf7\u7528 DOM API\u3002\u53e6\u5916&#xff0c;on-demand \u7684\u60f0\u6027\u610f\u5473\u7740\u67d0\u4e9b\u9519\u8bef&#xff08;\u5982\u5b57\u6bb5\u7c7b\u578b\u4e0d\u5339\u914d&#xff09;\u4f1a\u5728&#034;\u53d6\u503c\u90a3\u4e00\u523b&#034;\u624d\u66b4\u9732&#xff0c;\u800c\u4e0d\u662f parse \u65f6\u3002<\/p>\n<h4 id=\"63-\u6d41\u5f0f\u89e3\u6790-parse_many\u4e00\u884c\u4e00\u6761ndjson\">6.3 \u6d41\u5f0f\u89e3\u6790 parse_many&#xff1a;\u4e00\u884c\u4e00\u6761&#xff08;NDJSON&#xff09;<\/h4>\n<p>\u65e5\u5fd7\u3001\u4e8b\u4ef6\u6d41\u6700\u5e38\u89c1\u7684\u683c\u5f0f\u662f\u00a0NDJSON&#xff08;Newline-Delimited JSON&#xff0c;\u6bcf\u884c\u4e00\u6761 JSON&#xff09;\u3002\u7528\u00a0parse_many\u00a0\u53ef\u4ee5\u6d41\u5f0f\u5904\u7406&#xff0c;\u4e0d\u7528\u7b49\u6574\u4e2a\u6587\u4ef6\u8bfb\u5b8c&#xff1a;<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;simdjson.h&gt;<\/p>\n<p>int main() {<br \/>\n    \/\/ \u6a21\u62df 3 \u884c NDJSON&#xff08;\u672b\u5c3e\u4e0d\u8981\u6f0f\u6362\u884c&#xff0c;parse_many \u9700\u8981\u9760\u5b83\u5207\u5206&#xff09;<br \/>\n    std::string ndjson &#061; R&#034;({&#034;level&#034;:&#034;INFO&#034;,&#034;msg&#034;:&#034;started&#034;}<br \/>\n{&#034;level&#034;:&#034;ERROR&#034;,&#034;msg&#034;:&#034;disk full&#034;}<br \/>\n{&#034;level&#034;:&#034;WARN&#034;,&#034;msg&#034;:&#034;retry&#034;}<br \/>\n)&#034;;<\/p>\n<p>    simdjson::dom::parser parser;<br \/>\n    simdjson::dom::document_stream docs &#061; parser.parse_many(ndjson);<\/p>\n<p>    \/\/ \u904d\u5386\u6bcf\u4e00\u884c JSON<br \/>\n    for (simdjson::dom::element doc : docs) {<br \/>\n        if (doc.error()) {<br \/>\n            std::cerr &lt;&lt; &#034;\u67d0\u884c\u89e3\u6790\u5931\u8d25: &#034; &lt;&lt; simdjson::error_message(doc.error()) &lt;&lt; std::endl;<br \/>\n            continue;<br \/>\n        }<br \/>\n        std::string_view level &#061; doc[&#034;level&#034;];<br \/>\n        std::string_view msg   &#061; doc[&#034;msg&#034;];<br \/>\n        std::cout &lt;&lt; &#034;[&#034; &lt;&lt; level &lt;&lt; &#034;] &#034; &lt;&lt; msg &lt;&lt; std::endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u26a0\ufe0f\u00a0parse_many\u00a0\u8981\u6c42\u8f93\u5165\u4ee5\u6362\u884c\u7b26\u5206\u9694\u4e14\u672b\u5c3e\u6709\u6362\u884c&#xff1b;\u6587\u4ef6\u592a\u5927\u65f6\u53ef\u7528\u00a0parse_many(json, batch_size)\u00a0\u6307\u5b9a\u6279\u5927\u5c0f\u63a7\u5236\u5185\u5b58\u3002<\/p>\n<h4 id=\"64-minify\u628a-json-\u538b\u5230\u6700\u5c0f\">6.4 minify&#xff1a;\u628a JSON \u538b\u5230\u6700\u5c0f<\/h4>\n<p>minify\u00a0\u4f1a\u53bb\u6389 JSON \u4e2d\u6240\u6709\u53ef\u6709\u53ef\u65e0\u7684\u7a7a\u767d&#xff08;\u7a7a\u683c\u3001\u6362\u884c\u3001\u5236\u8868\u7b26&#xff09;&#xff0c;\u5e38\u7528\u4e8e\u51cf\u5c11\u5b58\u50a8\u548c\u7f51\u7edc\u4f20\u8f93\u4f53\u79ef&#xff1a;<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;simdjson.h&gt;<\/p>\n<p>int main() {<br \/>\n    std::string pretty_json &#061; R&#034;({<br \/>\n        &#034;name&#034; : &#034;simdjson&#034;,<br \/>\n        &#034;stars&#034; : 20000<br \/>\n    })&#034;;<\/p>\n<p>    \/\/ minify \u76f4\u63a5\u539f\u5730\u538b\u7f29&#xff08;\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u8f93\u51fa\u7f13\u51b2&#xff0c;\u9700\u9884\u7559\u7a7a\u95f4&#xff09;<br \/>\n    std::string compact;<br \/>\n    compact.resize(pretty_json.size());        \/\/ \u538b\u7f29\u7ed3\u679c\u4e0d\u4f1a\u6bd4\u539f\u6587\u66f4\u957f&#xff0c;\u9884\u7559\u5373\u53ef<br \/>\n    size_t written &#061; simdjson::minify(pretty_json, compact.data());<br \/>\n    compact.resize(written);                    \/\/ \u622a\u65ad\u5230\u5b9e\u9645\u5199\u5165\u957f\u5ea6<\/p>\n<p>    std::cout &lt;&lt; &#034;\u538b\u7f29\u524d: &#034; &lt;&lt; pretty_json.size() &lt;&lt; &#034; \u5b57\u8282&#034; &lt;&lt; std::endl;<br \/>\n    std::cout &lt;&lt; &#034;\u538b\u7f29\u540e: &#034; &lt;&lt; compact.size() &lt;&lt; &#034; \u5b57\u8282&#034; &lt;&lt; std::endl;<br \/>\n    std::cout &lt;&lt; compact &lt;&lt; std::endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u26a0\ufe0f minify \u4e0d\u4f1a\u5220\u9664\u5b57\u7b26\u4e32\u5185\u90e8\u7684\u7a7a\u683c&#xff0c;\u4f8b\u5982\u00a0&#034;hello world&#034;\u00a0\u91cc\u7684\u7a7a\u683c\u662f\u6570\u636e\u7684\u4e00\u90e8\u5206&#xff0c;\u5fc5\u987b\u4fdd\u7559\u3002<\/p>\n<h4 id=\"65-json-pointer\u6309\u8def\u5f84\u7cbe\u51c6\u53d6\u503c\">6.5 JSON Pointer&#xff1a;\u6309\u8def\u5f84\u7cbe\u51c6\u53d6\u503c<\/h4>\n<p>JSON Pointer&#xff08;RFC 6901&#xff09;\u7528\u00a0\/\u00a0\u5206\u9694\u7684\u8def\u5f84\u5b57\u7b26\u4e32\u5b9a\u4f4d\u6df1\u5c42\u5b57\u6bb5&#xff0c;\u9002\u5408&#034;\u8def\u5f84\u6765\u81ea\u914d\u7f6e\u6216\u5916\u90e8\u8f93\u5165&#034;\u7684\u573a\u666f&#xff1a;<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;simdjson.h&gt;<\/p>\n<p>int main() {<br \/>\n    std::string json &#061; R&#034;({<br \/>\n        &#034;api&#034;: {<br \/>\n            &#034;v1&#034;: {<br \/>\n                &#034;endpoints&#034;: [&#034;\/login&#034;, &#034;\/logout&#034;],<br \/>\n                &#034;timeout_ms&#034;: 5000<br \/>\n            }<br \/>\n        }<br \/>\n    })&#034;;<\/p>\n<p>    simdjson::dom::parser parser;<br \/>\n    simdjson::dom::element doc &#061; parser.parse(json);<br \/>\n    if (doc.error()) return 1;<\/p>\n<p>    \/\/ at_pointer \u4f7f\u7528 JSON Pointer \u8bed\u6cd5&#xff1a;\/\u6839\u952e\/\u5b50\u952e\/\u6570\u7ec4\u4e0b\u6807<br \/>\n    std::string_view endpoint &#061; doc.at_pointer(&#034;\/api\/v1\/endpoints\/0&#034;);<br \/>\n    int64_t timeout &#061; doc.at_pointer(&#034;\/api\/v1\/timeout_ms&#034;);<\/p>\n<p>    std::cout &lt;&lt; &#034;endpoint&#061;&#034; &lt;&lt; endpoint &lt;&lt; std::endl;<br \/>\n    std::cout &lt;&lt; &#034;timeout &#061;&#034; &lt;&lt; timeout &lt;&lt; &#034; ms&#034; &lt;&lt; std::endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u7b49\u4ef7\u5199\u6cd5&#xff1a;doc[&#034;api&#034;][&#034;v1&#034;][&#034;endpoints&#034;][0]\u3002JSON Pointer \u7684\u4f18\u52bf\u662f\u8def\u5f84\u53ef\u4ee5\u52a8\u6001\u62fc\u63a5&#xff0c;\u6bd4\u5982\u00a0std::string path &#061; &#034;\/api\/&#034; &#043; version &#043; &#034;\/endpoints\/0&#034;\u3002<\/p>\n<h4 id=\"66-\u9519\u8bef\u5904\u7406\u4e0d\u629b\u5f02\u5e38\u7684\u4ee3\u4ef7\">6.6 \u9519\u8bef\u5904\u7406&#xff1a;\u4e0d\u629b\u5f02\u5e38\u7684\u4ee3\u4ef7<\/h4>\n<p>simdjson \u9ed8\u8ba4\u4e0d\u629b\u5f02\u5e38&#xff0c;\u6240\u6709\u53ef\u80fd\u5931\u8d25\u7684\u64cd\u4f5c\u90fd\u8fd4\u56de\u00a0simdjson_result&lt;T&gt;\u3002\u68c0\u67e5\u9519\u8bef\u6709\u4e24\u79cd\u65b9\u5f0f&#xff1a;<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;simdjson.h&gt;<\/p>\n<p>int main() {<br \/>\n    std::string bad_json &#061; R&#034;({&#034;name&#034;: &#034;Alice&#034;, )&#034;;   \/\/ \u6545\u610f\u7f3a\u53f3\u62ec\u53f7<\/p>\n<p>    simdjson::dom::parser parser;<\/p>\n<p>    \/\/ \u65b9\u5f0f\u4e00&#xff1a;\u7528 .error() \u5224\u65ad&#xff08;\u63a8\u8350&#xff09;<br \/>\n    simdjson::dom::element doc &#061; parser.parse(bad_json);<br \/>\n    if (doc.error()) {<br \/>\n        std::cout &lt;&lt; &#034;\u65b9\u5f0f\u4e00\u6355\u83b7\u9519\u8bef: &#034;<br \/>\n                  &lt;&lt; simdjson::error_message(doc.error()) &lt;&lt; std::endl;<br \/>\n        return 0;<br \/>\n    }<\/p>\n<p>    \/\/ \u65b9\u5f0f\u4e8c&#xff1a;\u76f4\u63a5\u628a\u7ed3\u679c\u5f53 bool \u7528&#xff08;simdjson_result \u91cd\u8f7d\u4e86 operator bool&#xff09;<br \/>\n    \/\/ simdjson::dom::element doc2 &#061; parser.parse(bad_json);<br \/>\n    \/\/ if (!doc2) { &#8230; }<br \/>\n    return 0;<br \/>\n}<\/p>\n<p>\u5982\u679c\u4f60\u66f4\u559c\u6b22\u5f02\u5e38\u98ce\u683c&#xff0c;\u53ef\u4ee5\u5728\u7f16\u8bd1\u65f6\u5b9a\u4e49\u00a0SIMDJSON_EXCEPTIONS&#061;ON&#xff0c;\u7136\u540e\u76f4\u63a5\u5199\u00a0simdjson::dom::element doc &#061; parser.parse(json);&#xff0c;\u51fa\u9519\u65f6\u5e93\u4f1a\u629b\u00a0simdjson_error\u3002<\/p>\n<p>\u26a0\ufe0f \u4e0d\u8981\u5ffd\u7565\u9519\u8bef\u8fd4\u56de\u503c&#xff01;\u89e3\u6790\u5931\u8d25\u65f6\u5143\u7d20\u5185\u5bb9\u662f\u672a\u5b9a\u4e49\u7684&#xff0c;\u7ee7\u7eed\u4f7f\u7528\u4f1a\u5f97\u5230\u5783\u573e\u6570\u636e\u3002<\/p>\n<hr \/>\n<h3 id=\"7-\u6613\u9519\u70b9\u4e0e\u6027\u80fd\u8c03\u4f18\u6e05\u5355\">7. \u6613\u9519\u70b9\u4e0e\u6027\u80fd\u8c03\u4f18\u6e05\u5355<\/h3>\n<table>\n<tbody>\n<tr>\u6613\u9519\u70b9 \/ \u8c03\u4f18\u70b9\u8bf4\u660e<\/tr>\n<tr>\n<td>1<\/td>\n<td>\u26a0\ufe0f\u00a0\u539f\u59cb\u7f13\u51b2\u533a\u751f\u547d\u5468\u671f<\/td>\n<td>\u96f6\u62f7\u8d1d\u610f\u5473\u7740\u89e3\u6790\u7ed3\u679c\u5f15\u7528\u539f\u6587\u672c\u3002\u8bf7\u786e\u4fdd JSON \u5b57\u7b26\u4e32\u5b58\u6d3b\u5230\u6240\u6709\u53d6\u503c\u7ed3\u675f\u3002<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u26a0\ufe0f\u00a0\u5fc5\u987b Release \u7f16\u8bd1<\/td>\n<td>Debug \u6a21\u5f0f\u5173\u95ed\u4f18\u5316&#xff0c;SIMD \u5185\u8054\u5931\u6548&#xff0c;\u6027\u80fd\u9aa4\u964d\u3002<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u26a0\ufe0f\u00a0\u4e0d\u8981\u590d\u7528\u540c\u4e00 DOM \u5143\u7d20\u8de8\u591a\u6b21 parse<\/td>\n<td>parser.parse()\u00a0\u4f1a\u590d\u7528\u5185\u90e8\u7f13\u51b2\u533a&#xff0c;\u65e7\u5143\u7d20\u89c6\u56fe\u53ef\u80fd\u5931\u6548&#xff1b;\u9700\u8981\u4fdd\u7559\u5c31\u590d\u5236\u6216\u6539\u7528 on-demand \u91cd\u65b0 iterate\u3002<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u26a0\ufe0f\u00a0on-demand \u662f\u5355\u904d\u8bfb\u53d6<\/td>\n<td>\u540c\u4e00\u8def\u5f84\u4e0d\u53ef\u91cd\u590d\u53d6&#xff1b;\u9700\u53cd\u590d\u8bfb\u8bf7\u7528 DOM\u3002<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u26a0\ufe0f\u00a0parse_many \u672b\u5c3e\u8981\u6709\u6362\u884c<\/td>\n<td>\u5426\u5219\u6700\u540e\u4e00\u6761\u53ef\u80fd\u89e3\u6790\u4e0d\u51fa\u6765\u6216\u62a5\u9519\u3002<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\u89e3\u6790\u5668\u590d\u7528<\/td>\n<td>\u4e00\u4e2a\u00a0parser\u00a0\u53cd\u590d\u00a0parse()&#xff0c;\u6bd4\u6bcf\u6b21 new \u4e00\u4e2a\u5feb\u5f97\u591a&#xff08;\u590d\u7528\u5185\u90e8\u7f13\u51b2\u533a&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\u5f00\u542f CPU \u539f\u751f\u6307\u4ee4\u96c6<\/td>\n<td>\u7f16\u8bd1\u52a0\u00a0-march&#061;native&#xff08;GCC\/Clang&#xff09;\u6216\u00a0\/arch:AVX2&#xff08;MSVC&#xff09;\u53ef\u8ba9 SIMD \u8def\u5f84\u56fa\u5b9a\u4e3a\u6700\u5f3a&#xff1b;\u6ce8\u610f\u6362\u673a\u5668\u90e8\u7f72\u65f6\u53ef\u80fd\u4e0d\u517c\u5bb9&#xff0c;\u751f\u4ea7\u5efa\u8bae\u4fdd\u7559\u8fd0\u884c\u65f6\u81ea\u52a8\u68c0\u6d4b\u3002<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>\u6309\u9700\u53d6\u7528&#xff0c;\u522b\u6574\u6811\u642c\u8fd0<\/td>\n<td>\u5927 JSON \u53ea\u53d6\u5c11\u6570\u5b57\u6bb5\u65f6\u7528 on-demand&#xff1b;\u5168\u90e8\u5b57\u6bb5\u90fd\u8981\u4e14\u53cd\u590d\u8bfb\u65f6\u7528 DOM\u3002<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>\u4f18\u5148\u00a0std::string_view<\/td>\n<td>\u53d6\u503c\u5c3d\u91cf\u4fdd\u7559 string_view&#xff0c;\u4e0d\u8981\u7acb\u523b\u8f6c\u00a0std::string&#xff08;\u4f1a\u89e6\u53d1\u62f7\u8d1d&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>\u5927\u6587\u4ef6\u5206\u6279<\/td>\n<td>\u8d85\u5927\u6587\u4ef6\u7528\u00a0parse_many(json, batch_size)\u00a0\u6216 mmap \u540e\u5206\u6bb5\u89e3\u6790&#xff0c;\u63a7\u5236\u5cf0\u503c\u5185\u5b58\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3 id=\"8-faq-\u901f\u67e5\u8868\">8. FAQ \u901f\u67e5\u8868<\/h3>\n<table>\n<tbody>\n<tr>\u95ee\u9898\u901f\u7b54<\/tr>\n<tr>\n<td>simdjson \u8981\u88c5\u4ec0\u4e48\u4f9d\u8d56&#xff1f;<\/td>\n<td>\u96f6\u7b2c\u4e09\u65b9\u4f9d\u8d56&#xff0c;\u53ea\u6709 C&#043;&#043;17 \u7f16\u8bd1\u5668 &#043; CMake\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u6211\u9700\u8981\u5728\u4ee3\u7801\u91cc\u5199 SIMD \u5417&#xff1f;<\/td>\n<td>\u4e0d\u9700\u8981&#xff0c;\u5e93\u5185\u90e8\u81ea\u52a8\u5904\u7406&#xff0c;\u9ed8\u8ba4\u8fd0\u884c\u65f6\u81ea\u52a8\u68c0\u6d4b\u6307\u4ee4\u96c6\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u4e3a\u4ec0\u4e48\u6bd4\u6211\u624b\u5199\u7684\u89e3\u6790\u5668\u5feb\u8fd9\u4e48\u591a&#xff1f;<\/td>\n<td>\u4e00\u6b21\u5904\u7406 32\/64 \u5b57\u8282 &#043; \u96f6\u62f7\u8d1d\u89c6\u56fe &#043; \u60f0\u6027\u89e3\u6790&#xff0c;\u4e09\u5c42\u4f18\u5316\u53e0\u52a0\u3002<\/td>\n<\/tr>\n<tr>\n<td>simdjson \u80fd\u4fee\u6539 JSON \u5417&#xff1f;<\/td>\n<td>\u4e0d\u80fd\u4fee\u6539 DOM \u6811&#xff1b;\u53ea\u80fd\u8bfb\u53d6\u3001minify\u3002\u8981\u4fee\u6539\u8bf7\u7528 nlohmann\/json\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u548c nlohmann\/json \u600e\u4e48\u9009&#xff1f;<\/td>\n<td>\u53ea\u8bfb&#043;\u5927\u541e\u5410 \u2192 simdjson&#xff1b;\u8bfb\u5199\u90fd\u8981\/\u56fe\u7701\u4e8b \u2192 nlohmann\/json\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u89e3\u6790\u7ed3\u679c\u80fd\u4fdd\u5b58\u5230\u4e0b\u6b21\u518d\u7528\u5417&#xff1f;<\/td>\n<td>DOM \u5143\u7d20\u8de8 parse \u4f1a\u5931\u6548&#xff1b;\u957f\u671f\u4fdd\u5b58\u8bf7\u590d\u5236\u6570\u636e\u6216\u8f6c\u6210\u81ea\u5df1\u7684\u7ed3\u6784\u3002<\/td>\n<\/tr>\n<tr>\n<td>on-demand \u548c DOM \u6709\u4ec0\u4e48\u533a\u522b&#xff1f;<\/td>\n<td>on-demand \u7528\u5230\u624d\u89e3\u6790&#xff08;\u5feb\u3001\u7701\u5185\u5b58\u3001\u5355\u904d&#xff09;&#xff1b;DOM \u4e00\u6b21\u5efa\u5168\u6811&#xff08;\u53ef\u53cd\u590d\u8bfb&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u652f\u6301 JSON \u91cc\u7684\u5927\u6570\u5b57&#xff08;\u8d85\u8fc7 int64&#xff09;\u5417&#xff1f;<\/td>\n<td>\u6570\u5b57\u4ee5 int64\/double \u4e3a\u4e3b&#xff0c;\u8d85\u5927\u6574\u6570\u9700\u81ea\u5df1\u6309\u5b57\u7b26\u4e32\u53d6&#xff08;get_raw_json_number&#xff09;\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u652f\u6301 Windows \u5417&#xff1f;<\/td>\n<td>\u652f\u6301 MSVC 2019&#043;&#xff1b;\u540c\u6837\u81ea\u52a8\u9009\u62e9 SSE4\/AVX2 \u8def\u5f84\u3002<\/td>\n<\/tr>\n<tr>\n<td>\u51fa\u9519\u4f1a\u5d29\u5417&#xff1f;<\/td>\n<td>\u4e0d\u4f1a&#xff0c;\u9ed8\u8ba4\u8fd4\u56de\u9519\u8bef\u7801&#xff1b;\u53ef\u9009\u5f00\u542f\u5f02\u5e38\u6a21\u5f0f\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3 id=\"9-\u53c2\u8003\u8d44\u6599\">9. \u53c2\u8003\u8d44\u6599<\/h3>\n<ul>\n<li>simdjson \u5b98\u65b9\u4ed3\u5e93\u4e0e\u6587\u6863&#xff1a;GitHub &#8211; simdjson\/simdjson: Parsing gigabytes of JSON per second : used by Facebook\/Meta Velox, the Node.js runtime, ClickHouse, WatermelonDB, Apache Doris, Milvus, StarRocks \u00b7 GitHub&#xff08;\u542b API \u6587\u6863\u3001\u6027\u80fd\u62a5\u544a&#xff09;<\/li>\n<li>G. Langdale, D. Lemire.\u00a0Parsing gigabytes of JSON per second.\u00a0VLDB Journal, 2019.<\/li>\n<li>RFC 8259&#xff08;JSON \u6570\u636e\u4ea4\u6362\u683c\u5f0f&#xff09;\u3001RFC 6901&#xff08;JSON Pointer&#xff09;<\/li>\n<li>\u76f8\u5173\u9605\u8bfb&#xff08;\u672c\u7ad9\u5df2\u53d1\u5e03\u7684 C&#043;&#043; \u4e3b\u9898&#xff09;&#xff1a;nlohmann\/json \u5f00\u6e90 JSON \u5e93\u3001Google Benchmark \u5f00\u6e90\u57fa\u51c6\u6d4b\u8bd5\u5e93<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u9002\u7528\u8bfb\u8005&#xff1a;\u521a\u5165\u95e8 C \u7684\u5f00\u53d1\u8005\u3001\u88ab JSON \u89e3\u6790\u901f\u5ea6\u56f0\u6270\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\u3001\u4e00\u5207\u5bf9\\&#8221;\u6bcf\u79d2\u80fd\u5403\u6389\u591a\u5c11\u6761\u65e5\u5fd7\\&#8221;\u6709\u6267\u5ff5\u7684\u4eba\u3002 \u672c\u6587\u7ea6\u5b9a&#xff1a;\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u57fa\u4e8e simdjson\u00a0v3.x&#xff08;\u5411\u4e0b\u517c\u5bb9 v2.x \u7684 DOM \u7528\u6cd5&#xff09;&#xff0c;\u8981\u6c42 C17 \u53ca\u4ee5\u4e0a\u3002 1. \u8fd9\u5e93\u662f\u4ec0\u4e48&#xff1a;30 \u79d2\u8ba4\u8bc6 simdjson<br \/>\nsimdjson\u00a0\u662f\u4e00\u4e2a\u7528 C \u7f16\u5199\u7684\u9ad8\u6027\u80fd JSON \u89e3\u6790\u5e93&#xff0c;\u6838\u5fc3\u5356\u70b9\u5c31\u4e00\u53e5\u8bdd&amp;#xff1a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9137,55,93,190],"topic":[],"class_list":["post-93870","post","type-post","status-publish","format-standard","hentry","category-server","tag-atomgit","tag-c","tag-json","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/93870.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u9002\u7528\u8bfb\u8005&#xff1a;\u521a\u5165\u95e8 C \u7684\u5f00\u53d1\u8005\u3001\u88ab JSON \u89e3\u6790\u901f\u5ea6\u56f0\u6270\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\u3001\u4e00\u5207\u5bf9&quot;\u6bcf\u79d2\u80fd\u5403\u6389\u591a\u5c11\u6761\u65e5\u5fd7&quot;\u6709\u6267\u5ff5\u7684\u4eba\u3002 \u672c\u6587\u7ea6\u5b9a&#xff1a;\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u57fa\u4e8e simdjson\u00a0v3.x&#xff08;\u5411\u4e0b\u517c\u5bb9 v2.x \u7684 DOM \u7528\u6cd5&#xff09;&#xff0c;\u8981\u6c42 C17 \u53ca\u4ee5\u4e0a\u3002 1. \u8fd9\u5e93\u662f\u4ec0\u4e48&#xff1a;30 \u79d2\u8ba4\u8bc6 simdjson simdjson\u00a0\u662f\u4e00\u4e2a\u7528 C \u7f16\u5199\u7684\u9ad8\u6027\u80fd JSON \u89e3\u6790\u5e93&#xff0c;\u6838\u5fc3\u5356\u70b9\u5c31\u4e00\u53e5\u8bdd&amp;#xff1a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/93870.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-13T02:49:25+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/93870.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/93870.html\",\"name\":\"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-13T02:49:25+00:00\",\"dateModified\":\"2026-08-13T02:49:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/93870.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/93870.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/93870.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/93870.html","og_locale":"zh_CN","og_type":"article","og_title":"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u9002\u7528\u8bfb\u8005&#xff1a;\u521a\u5165\u95e8 C \u7684\u5f00\u53d1\u8005\u3001\u88ab JSON \u89e3\u6790\u901f\u5ea6\u56f0\u6270\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\u3001\u4e00\u5207\u5bf9\"\u6bcf\u79d2\u80fd\u5403\u6389\u591a\u5c11\u6761\u65e5\u5fd7\"\u6709\u6267\u5ff5\u7684\u4eba\u3002 \u672c\u6587\u7ea6\u5b9a&#xff1a;\u6240\u6709\u793a\u4f8b\u4ee3\u7801\u57fa\u4e8e simdjson\u00a0v3.x&#xff08;\u5411\u4e0b\u517c\u5bb9 v2.x \u7684 DOM \u7528\u6cd5&#xff09;&#xff0c;\u8981\u6c42 C17 \u53ca\u4ee5\u4e0a\u3002 1. \u8fd9\u5e93\u662f\u4ec0\u4e48&#xff1a;30 \u79d2\u8ba4\u8bc6 simdjson simdjson\u00a0\u662f\u4e00\u4e2a\u7528 C \u7f16\u5199\u7684\u9ad8\u6027\u80fd JSON \u89e3\u6790\u5e93&#xff0c;\u6838\u5fc3\u5356\u70b9\u5c31\u4e00\u53e5\u8bdd&amp;#xff1a","og_url":"https:\/\/www.wsisp.com\/helps\/93870.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-13T02:49:25+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/93870.html","url":"https:\/\/www.wsisp.com\/helps\/93870.html","name":"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-13T02:49:25+00:00","dateModified":"2026-08-13T02:49:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/93870.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/93870.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/93870.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"simdjson\uff1a\u5229\u7528 SIMD \u6307\u4ee4\u5b9e\u73b0 GB\/s \u7ea7 JSON \u89e3\u6790\u7684 C++ \u5f00\u6e90\u5e93"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/93870","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=93870"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/93870\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=93870"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=93870"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=93870"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=93870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}