mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
... you are too slow and QJson API is so ugly. Now using this wonderful json lib: https://github.com/nlohmann/json Results in release mode (QJson tests are not shown but QJson was even slower than string concat). PASS : TestQgsJsonUtils::testExportAttributesJson(Use json) RESULT : TestQgsJsonUtils::testExportAttributesJson():"Use json": 0.0022 msecs per iteration (total: 75, iterations: 32768) PASS : TestQgsJsonUtils::testExportAttributesJson(Use old string concat) RESULT : TestQgsJsonUtils::testExportAttributesJson():"Use old string concat": 0.0032 msecs per iteration (total: 54, iterations: 16384) PASS : TestQgsJsonUtils::testExportFeatureJson(Use json) RESULT : TestQgsJsonUtils::testExportFeatureJson():"Use json": 0.011 msecs per iteration (total: 96, iterations: 8192) PASS : TestQgsJsonUtils::testExportFeatureJson(Use old string concat) RESULT : TestQgsJsonUtils::testExportFeatureJson():"Use old string concat": 0.015 msecs per iteration (total: 64, iterations: 4096) PASS : TestQgsJsonUtils::testExportGeomToJson(Use json) RESULT : TestQgsJsonUtils::testExportGeomToJson():"Use json": 0.76 msecs per iteration (total: 98, iterations: 128) PASS : TestQgsJsonUtils::testExportGeomToJson(Use old string concat) RESULT : TestQgsJsonUtils::testExportGeomToJson():"Use old string concat": 0.85 msecs per iteration (total: 55, iterations: 64) PASS : TestQgsJsonUtils::cleanupTestCase()
26 lines
720 B
C++
26 lines
720 B
C++
#pragma once
|
|
|
|
#include <nlohmann/detail/iterators/primitive_iterator.hpp>
|
|
|
|
namespace nlohmann
|
|
{
|
|
namespace detail
|
|
{
|
|
/*!
|
|
@brief an iterator value
|
|
|
|
@note This structure could easily be a union, but MSVC currently does not allow
|
|
unions members with complex constructors, see https://github.com/nlohmann/json/pull/105.
|
|
*/
|
|
template<typename BasicJsonType> struct internal_iterator
|
|
{
|
|
/// iterator for JSON objects
|
|
typename BasicJsonType::object_t::iterator object_iterator {};
|
|
/// iterator for JSON arrays
|
|
typename BasicJsonType::array_t::iterator array_iterator {};
|
|
/// generic iterator for all other types
|
|
primitive_iterator_t primitive_iterator {};
|
|
};
|
|
} // namespace detail
|
|
} // namespace nlohmann
|