|
@@ -5,48 +5,49 @@ TechEmpower Web Framework Benchmarks
|
|
|
<!--#declaration
|
|
|
#include "world.h"
|
|
|
|
|
|
+static char buffer[128];
|
|
|
static UREDISClient_Base* rc;
|
|
|
static UVector<World*>* pvworld;
|
|
|
|
|
|
#ifndef AS_cpoll_cppsp_DO
|
|
|
-static UValue* pvalue;
|
|
|
+static UValue* pvalue;
|
|
|
#endif
|
|
|
|
|
|
static void usp_fork_rupdate()
|
|
|
{
|
|
|
- U_TRACE(5, "::usp_fork_rupdate()")
|
|
|
+ U_TRACE(5, "::usp_fork_rupdate()")
|
|
|
|
|
|
- rc = U_NEW(UREDISClient<UTCPSocket>);
|
|
|
+ U_NEW(UREDISClient<UTCPSocket>, rc, UREDISClient<UTCPSocket>);
|
|
|
|
|
|
- if (rc->connect() == false)
|
|
|
- {
|
|
|
- U_WARNING("usp_fork_rupdate(): %V", rc->UClient_Base::getResponse().rep);
|
|
|
+ if (rc->connect() == false)
|
|
|
+ {
|
|
|
+ U_WARNING("usp_fork_rupdate(): %V", rc->UClient_Base::getResponse().rep);
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- pvworld = U_NEW(UVector<World*>(500));
|
|
|
+ U_NEW(UVector<World*>, pvworld, UVector<World*>(500));
|
|
|
|
|
|
#ifndef AS_cpoll_cppsp_DO
|
|
|
- pvalue = U_NEW(UValue(ARRAY_VALUE));
|
|
|
+ U_NEW(UValue, pvalue, UValue(ARRAY_VALUE));
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
static void usp_end_rupdate()
|
|
|
{
|
|
|
- U_TRACE(5, "::usp_end_rupdate()")
|
|
|
+ U_TRACE(5, "::usp_end_rupdate()")
|
|
|
|
|
|
- delete rc;
|
|
|
+ delete rc;
|
|
|
|
|
|
- if (pvworld)
|
|
|
- {
|
|
|
- delete pvworld;
|
|
|
+ if (pvworld)
|
|
|
+ {
|
|
|
+ delete pvworld;
|
|
|
|
|
|
-# ifndef AS_cpoll_cppsp_DO
|
|
|
- delete pvalue;
|
|
|
-# endif
|
|
|
- }
|
|
|
+# ifndef AS_cpoll_cppsp_DO
|
|
|
+ delete pvalue;
|
|
|
+# endif
|
|
|
+ }
|
|
|
}
|
|
|
#endif
|
|
|
-->
|
|
@@ -55,7 +56,7 @@ Content-Type: application/json
|
|
|
-->
|
|
|
<!--#code
|
|
|
World* pworld;
|
|
|
-char* pbuffer = u_buffer;
|
|
|
+char* pbuffer = buffer;
|
|
|
int i, num_queries = UHTTP::getFormFirstNumericValue(1, 500);
|
|
|
|
|
|
#ifdef AS_cpoll_cppsp_DO
|
|
@@ -63,41 +64,43 @@ USP_PUTS_CHAR('[');
|
|
|
#endif
|
|
|
|
|
|
for (i = 0; i < num_queries; ++i)
|
|
|
- {
|
|
|
- pvworld->push_back(pworld = U_NEW(World));
|
|
|
+ {
|
|
|
+ U_NEW(World, pworld, World);
|
|
|
+
|
|
|
+ pvworld->push_back(pworld);
|
|
|
|
|
|
- u_put_unalignedp64(pbuffer, U_MULTICHAR_CONSTANT64(' ','w','o','r','l','d',':','\0'));
|
|
|
+ u_put_unalignedp64(pbuffer, U_MULTICHAR_CONSTANT64(' ','w','o','r','l','d',':','\0'));
|
|
|
|
|
|
- pbuffer += 7+u_num2str32(pbuffer+7, pworld->id = u_get_num_random(10000));
|
|
|
- }
|
|
|
+ pbuffer += 7+u_num2str32(pbuffer+7, pworld->id = u_get_num_random(10000-1));
|
|
|
+ }
|
|
|
|
|
|
-(void) rc->mget(u_buffer, pbuffer-u_buffer);
|
|
|
+(void) rc->mget(buffer, pbuffer-buffer);
|
|
|
|
|
|
i = 0;
|
|
|
-pbuffer = u_buffer;
|
|
|
+pbuffer = buffer;
|
|
|
|
|
|
while (true)
|
|
|
{
|
|
|
- pworld = pvworld->at(i);
|
|
|
+ pworld = pvworld->at(i);
|
|
|
|
|
|
- u_put_unalignedp64(pbuffer, U_MULTICHAR_CONSTANT64(' ','w','o','r','l','d',':','\0'));
|
|
|
+ u_put_unalignedp64(pbuffer, U_MULTICHAR_CONSTANT64(' ','w','o','r','l','d',':','\0'));
|
|
|
|
|
|
- pbuffer += 7+u_num2str32(pbuffer+7, pworld->id);
|
|
|
+ pbuffer += 7+u_num2str32(pbuffer+7, pworld->id);
|
|
|
*pbuffer = ' ';
|
|
|
- pbuffer += 1+u_num2str32(pbuffer+1, pworld->randomNumber = u_get_num_random(10000));
|
|
|
+ pbuffer += 1+u_num2str32(pbuffer+1, pworld->randomNumber = u_get_num_random(10000-1));
|
|
|
|
|
|
#ifdef AS_cpoll_cppsp_DO
|
|
|
- USP_PRINTF("{\"id\":%u,\"randomNumber\":%u}", pworld->id, pworld->randomNumber);
|
|
|
+ USP_PRINTF("{\"id\":%u,\"randomNumber\":%u}", pworld->id, pworld->randomNumber);
|
|
|
#endif
|
|
|
|
|
|
if (++i == num_queries) break;
|
|
|
|
|
|
#ifdef AS_cpoll_cppsp_DO
|
|
|
- USP_PUTS_CHAR(',');
|
|
|
+ USP_PUTS_CHAR(',');
|
|
|
#endif
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
-(void) rc->mset(u_buffer, pbuffer-u_buffer);
|
|
|
+(void) rc->mset(buffer, pbuffer-buffer);
|
|
|
|
|
|
#ifdef AS_cpoll_cppsp_DO
|
|
|
USP_PUTS_CHAR(']');
|