我正在C++和im中开发一个服务器/客户端应用程序,使用Qt作为我的IDE以及它的一些库。就性能而言,我被告知在服务器和客户端之间传输数据的最好方法之一是通过JSON。但是,我想知道Qt中解析JSON的默认类(QJsonArray,QJsonObject)之间的性能差异。)和其他C++解析器,例如JSON++。
发布于 2014-07-25 06:45:05
如果Qt类没有足够的性能,可以查看RapidJson:https://github.com/miloyip/rapidjson
性能比较:http://code.google.com/p/rapidjson/wiki/Performance
RapidJson的好处(除了它的速度)是容易安装和使用。在其网站上:
rapidjson是一个只有头的库。这意味着,唯一要做的事情是将rapidjson/ include /rapidjson及其子目录复制到您的项目或其他包含路径。
还有他们的wiki页面上的例子:
#include "rapidjson/document.h"
#include <cstdio>
int main() {
const char json[] = "{ \"hello\" : \"world\" }";
rapidjson::Document d;
d.Parse<0>(json);
printf("%s\n", d["hello"].GetString());
return 0;
}https://stackoverflow.com/questions/24946395
复制相似问题