{"id":1074,"date":"2014-10-31T11:14:38","date_gmt":"2014-10-31T03:14:38","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=1074"},"modified":"2014-10-31T11:15:17","modified_gmt":"2014-10-31T03:15:17","slug":"qjson%e4%b8%8erapidjson%e6%80%a7%e8%83%bd%e7%9a%84%e7%ae%80%e5%8d%95%e5%af%b9%e6%af%94%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=1074","title":{"rendered":"QJson\u4e0eRapidJson\u6027\u80fd\u7684\u7b80\u5355\u5bf9\u6bd4\u6d4b\u8bd5"},"content":{"rendered":"<p>\u76d2\u5b50\u4e0a\u4e00\u4f4d\u670b\u53cb\u60f3\u77e5\u9053QJson\u548cC++\u7f16\u5199\u7684RapidJson\u4e4b\u95f4\u7684\u6027\u80fd\u5bf9\u6bd4\u60c5\u51b5\uff0c\u9650\u4e8e\u7cbe\u529b\uff0c\u6211\u53ea\u662f\u7b80\u5355\u7684\u6d4b\u8bd5\u4e86\u4e0b\u52a0\u8f7d\u4e00\u4e2a\u5927\u7684Json\u6587\u4ef6\u6765\u5bf9\u6bd4\u89e3\u6790\u6027\u80fd\uff08Demos\\Delphi\\VCL\\QJson\\Preferences.txt\uff0c\u6587\u4ef6\u5927\u5c0f\uff1a9.81MB\uff09\uff0c\u4f46\u505a\u6d4b\u8bd5\u5927\u5bb6\u90fd\u77e5\u9053\u4e0e\u6d4b\u8bd5\u6837\u672c\u7684\u5173\u7cfb\u5f88\u5927\uff0c\u8fd9\u91cc\u53ea\u5bf9\u8fd9\u4e00\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u8d1f\u8d23\uff0cRapidJson\u662f\u4ece\u5b98\u7f51\u4e0b\u8f7d\u76840.11\u7248\u3002<\/p>\n<p>1\u3001\u6211\u4eec\u5148\u6539\u4e0brapidjson.h\uff0c\u6ce8\u91ca\u6389\u4e0d\u517c\u5bb9\u7684\u4ee3\u7801\uff0816-21\u884c\u6539\u6210\u4e0b\u9762\u7684\u6837\u5b50\uff09\uff1a<\/p>\n<pre class=\"lang:c++ decode:true \">\/\/#ifdef _MSC_VER\r\ntypedef __int64 int64_t;\r\ntypedef unsigned __int64 uint64_t;\r\n\/\/#else\r\n\/\/#include &lt;inttypes.h&gt;\r\n\/\/#endif<\/pre>\n<p>2\u3001\u65b0\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u9879\u76ee\uff0c\u7531\u4e8e\u6587\u4ef6\u662fAnsi\u7f16\u7801\u7684\uff0c\u800crapidjson\u662f\u7528UTF8\u7f16\u7801\u7684\uff0c\u6240\u4ee5\u9700\u8981\u8f6c\u4e0b\u7801\uff0c\u5177\u4f53\u6d4b\u8bd5\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:c++ decode:true \">DWORD T=GetTickCount();\r\nTStringStream *AStream=new TStringStream;\r\nAStream-&gt;LoadFromFile(\"C:\\\\User\\\\QDAC3.0\\\\Demos\\\\Delphi\\\\VCL\\\\QJson\\\\Preferences.txt\");\r\nUTF8String U=AStream-&gt;DataString;\r\nDocument document;\r\ndocument.Parse&lt;0&gt;(U.c_str());\r\nT=GetTickCount()-T;\r\nShowMessage(IntToStr((int)T)+\"ms\");\r\ndelete AStream;<\/pre>\n<p>3\u3001\u4fee\u6539\u5de5\u7a0b\u7f16\u8bd1\u76ee\u6807\u4e3aWindows 64\u4f4d\uff0c32\u4f4d\u4e0bBorland C++\u7f16\u8bd1\u5668\u7531\u4e8e\u517c\u5bb9\u6027\u95ee\u9898\u65e0\u6cd5\u987a\u5229\u7f16\u8bd1\u901a\u8fc7\u3002<\/p>\n<p>4\u3001\u8fd0\u884c\u6d4b\u8bd5\u4ee3\u7801\uff0c\u5f97\u5230\u89e3\u6790\u7ed3\u679c\u3002<\/p>\n<p>\u81f3\u4e8eQJson\uff0c\u76f4\u63a5\u8fd0\u884c\u6f14\u793a\u7a0b\u5e8f\uff0c\u7528\u4ece\u6587\u4ef6\u4e2d\u52a0\u8f7d\u6309\u94ae\u539f\u6765\u7684\u4ee3\u7801\u6d4b\u8bd5\u52a0\u8f7d\u65f6\u95f4\u3002\u4e3a\u4e86\u516c\u5f00\u8d77\u89c1\uff0c\u4e24\u8005\u5747\u7f16\u8bd1\u4e3a64\u4f4d\uff0cRelease\u6a21\u5f0f\u3002<\/p>\n<p>\u6d4b\u8bd5\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<p>QJson:94ms\uff0894*100\/140=67.14%\uff09<\/p>\n<p>RapidJson\uff1a140ms\uff08100%\uff09<\/p>\n<p>QJson\u8981\u660e\u663e\u66f4\u5feb\u4e00\u4e9b\uff0c\u4f46\u8fd9\u4e2a\u6d4b\u8bd5\u56e0\u4e3a\u6bd4\u8f83\u7b80\u5355\uff0c\u53ef\u80fd\u5bf9RapidJson\u672a\u5fc5\u5b8c\u5168\u516c\u5e73\uff0c\u4ec5\u4f9b\u53c2\u8003\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76d2\u5b50\u4e0a\u4e00\u4f4d\u670b\u53cb\u60f3\u77e5\u9053QJson\u548cC++\u7f16 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,9,7,21],"tags":[143],"class_list":["post-1074","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-qdac","category-qjson","category-misc","tag-rapidjson"],"views":7571,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1074","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1074"}],"version-history":[{"count":2,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1074\/revisions"}],"predecessor-version":[{"id":1076,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1074\/revisions\/1076"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}