diff --git a/include/ulib/json/value.h b/include/ulib/json/value.h index ba8d0add..d5d36a8f 100644 --- a/include/ulib/json/value.h +++ b/include/ulib/json/value.h @@ -267,7 +267,7 @@ public: // OPERATOR - bool operator==(const UValue& v) const; + bool operator==(const UValue& v) const __pure; bool operator!=(const UValue& v) const { return ! operator==(v); } // SERVICES diff --git a/src/ulib/json/value.cpp b/src/ulib/json/value.cpp index ab7d64f5..84b4a2ae 100644 --- a/src/ulib/json/value.cpp +++ b/src/ulib/json/value.cpp @@ -252,7 +252,7 @@ void UValue::set(const UValue& v) U_ASSERT(invariant()) } -bool UValue::operator==(const UValue& v) const +__pure bool UValue::operator==(const UValue& v) const { U_TRACE(0+256, "UValue::operator==(%p)", &v) diff --git a/src/ulib/net/server/plugin/usp/equery.usp b/src/ulib/net/server/plugin/usp/equery.usp index 39977501..5a867838 100644 --- a/src/ulib/net/server/plugin/usp/equery.usp +++ b/src/ulib/net/server/plugin/usp/equery.usp @@ -95,6 +95,8 @@ while (true) #ifdef AS_cpoll_cppsp_DO USP_PUTS_CHAR(','); #endif + + rnumber.clear(); } #ifdef AS_cpoll_cppsp_DO diff --git a/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/equery.usp b/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/equery.usp index d175974a..5a867838 100644 --- a/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/equery.usp +++ b/tests/examples/benchmark/FrameworkBenchmarks/ULib/src/equery.usp @@ -11,7 +11,7 @@ static World* pworld_query; static UElasticSearchClient* es; #ifndef AS_cpoll_cppsp_DO -static UValue* pvalue; +static UValue* pvalue; static UVector* pvworld_query; #endif @@ -19,45 +19,45 @@ static UVector* pvworld_query; static void usp_fork_equery() { - U_TRACE(5, "::usp_fork_equery()") + U_TRACE(5, "::usp_fork_equery()") U_NEW(UElasticSearchClient, es, UElasticSearchClient); - if (es->connect() == false) - { - U_WARNING("usp_fork_equery(): connection disabled or failed"); + if (es->connect() == false) + { + U_WARNING("usp_fork_equery(): connection disabled or failed"); - return; - } + return; + } - U_NEW(World, pworld_query, World); - U_NEW(UString, jquery, U_STRING_FROM_CONSTANT("randomNumber")); + U_NEW(World, pworld_query, World); + U_NEW(UString, jquery, U_STRING_FROM_CONSTANT("randomNumber")); #ifndef AS_cpoll_cppsp_DO - U_NEW(UValue, pvalue, UValue(ARRAY_VALUE)); - U_NEW(UVector, pvworld_query, UVector(500)); + U_NEW(UValue, pvalue, UValue(ARRAY_VALUE)); + U_NEW(UVector, pvworld_query, UVector(500)); #endif - u__memcpy(buffer, "{\"query\":{\"match\":{\"_id\":\"", QLEN, __PRETTY_FUNCTION__); + u__memcpy(buffer, "{\"query\":{\"match\":{\"_id\":\"", QLEN, __PRETTY_FUNCTION__); } #ifdef DEBUG static void usp_end_equery() { - U_TRACE(5, "::usp_end_equery()") + U_TRACE(5, "::usp_end_equery()") - delete es; + delete es; - if (jquery) - { - delete jquery; - delete pworld_query; + if (jquery) + { + delete jquery; + delete pworld_query; -# ifndef AS_cpoll_cppsp_DO - delete pvalue; - delete pvworld_query; -# endif - } +# ifndef AS_cpoll_cppsp_DO + delete pvalue; + delete pvworld_query; +# endif + } } #endif --> @@ -73,29 +73,31 @@ USP_PUTS_CHAR('['); #endif while (true) - { - (void) es->sendPOST(U_CONSTANT_TO_PARAM("/tfb/world/_search"), buffer, QLEN+u__snprintf(buffer+QLEN, 128, "%u\"}}}", pworld_query->id = u_get_num_random(10000-1))); + { + (void) es->sendPOST(U_CONSTANT_TO_PARAM("/tfb/world/_search"), buffer, QLEN+u__snprintf(buffer+QLEN, 128, "%u\"}}}", pworld_query->id = u_get_num_random(10000-1))); - (void) UValue::jfind(es->getContent(), *jquery, rnumber); + (void) UValue::jfind(es->getContent(), *jquery, rnumber); #ifdef AS_cpoll_cppsp_DO - USP_PRINTF("{\"id\":%u,\"randomNumber\":%v}", pworld_query->id, rnumber.rep); + USP_PRINTF("{\"id\":%u,\"randomNumber\":%v}", pworld_query->id, rnumber.rep); #else - pworld_query->randomNumber = u_strtoul(rnumber.data(), rnumber.end()); + pworld_query->randomNumber = u_strtoul(rnumber.data(), rnumber.end()); - World* pworld; + World* pworld; - U_NEW(World, pworld, World(*pworld_query)); + U_NEW(World, pworld, World(*pworld_query)); - pvworld_query->push_back(pworld); + pvworld_query->push_back(pworld); #endif - if (++i == num_queries) break; + if (++i == num_queries) break; #ifdef AS_cpoll_cppsp_DO - USP_PUTS_CHAR(','); + USP_PUTS_CHAR(','); #endif - } + + rnumber.clear(); + } #ifdef AS_cpoll_cppsp_DO USP_PUTS_CHAR(']'); diff --git a/tests/examples/benchmark/FrameworkBenchmarks/ULib/ulib.sh b/tests/examples/benchmark/FrameworkBenchmarks/ULib/ulib.sh index 0942974f..a2497b58 100755 --- a/tests/examples/benchmark/FrameworkBenchmarks/ULib/ulib.sh +++ b/tests/examples/benchmark/FrameworkBenchmarks/ULib/ulib.sh @@ -98,7 +98,8 @@ make install # 3. Compile usp pages for benchmark (no more REDIS) cd ../../src/ulib/net/server/plugin/usp -make json.la plaintext.la db.la query.la update.la fortune.la \ +make json.la plaintext.la edb.la equery.la eupdate.la \ + db.la query.la update.la fortune.la \ mdb.la mquery.la mupdate.la mfortune.la # rdb.la rquery.la rupdate.la rfortune.la @@ -109,6 +110,7 @@ fi mkdir -p $ULIB_DOCUMENT_ROOT cp .libs/json.so .libs/plaintext.so \ + .libs/edb.so .libs/equery.so .libs/eupdate.so \ .libs/db.so .libs/query.so .libs/update.so .libs/fortune.so \ .libs/mdb.so .libs/mquery.so .libs/mupdate.so .libs/mfortune.so $ULIB_DOCUMENT_ROOT # .libs/rdb.so .libs/rquery.so .libs/rupdate.so .libs/rfortune.so \