nitpicks
authorgggeek <giunta.gaetano@gmail.com>
Wed, 1 Feb 2023 17:20:46 +0000 (17:20 +0000)
committergggeek <giunta.gaetano@gmail.com>
Wed, 1 Feb 2023 17:20:46 +0000 (17:20 +0000)
demo/client/parallel.php
extras/benchmark.php

index f785316..26ba1f3 100644 (file)
@@ -83,6 +83,9 @@ class ParallelClient extends Client
     }
 }
 
+// a minimal benchmark - use 3 strategies to execute the same 25 calls: sequentially, using parallel http requests, and
+// using a single system.multiCall request
+
 $num_tests = 25;
 
 $data = array(1, 1.0, 'hello world', true, '20051021T23:43:00', -1, 11.0, '~!@#$%^&*()_+|', false, '20051021T23:43:00');
@@ -96,15 +99,12 @@ for ($i = 0; $i < $num_tests; $i++) {
 
 $client = new ParallelClient(XMLRPCSERVER);
 
-// a minimal benchmark - use 3 strategies to execute the same 25 calls: sequentially, using parallel http requests, and
-// using a single system.multiCall request
-
-echo "Making $num_tests xml-rpc calls...\n";
-flush();
-
 // avoid storing http info in the responses, to make the checksums comparable
 $client->setDebug(-1);
 
+echo "Making $num_tests calls to method interopEchoTests.echoValue on server " . XMLRPCSERVER . " ...\n";
+flush();
+
 $client->setOption(Client::OPT_NO_MULTICALL,  true);
 $t = microtime(true);
 $resp = $client->send($reqs);
@@ -114,7 +114,6 @@ echo "Response checksum: " . md5(var_export($resp, true)) . "\n";
 flush();
 
 if (strpos(XMLRPCSERVER, 'http://') === 0) {
-    $client->setOption(Client::OPT_NO_MULTICALL,  true);
     $client->setOption(Client::OPT_USE_CURL,  Client::USE_CURL_ALWAYS);
     $t = microtime(true);
     $resp = $client->send($reqs);
@@ -132,6 +131,8 @@ echo "Response checksum: " . md5(var_export($resp, true)) . "\n";
 flush();
 
 $client->setOption(Client::OPT_NO_MULTICALL, false);
+// make sure we don't reuse the keepalive handle
+$client->setOption(Client::OPT_USE_CURL,  Client::USE_CURL_NEVER);
 $t = microtime(true);
 $resp = $client->send($reqs);
 $t = microtime(true) - $t;
index 7cb44eb..c064bc8 100644 (file)
@@ -152,7 +152,7 @@ for ($i = 0; $i < $num_tests; $i++) {
         foreach($val1 as $name => $val) {
             $out[$name] = array();
             foreach($val as $data) {
-                $out[$name][] = $data->scalarval();
+                $out[$name][] = $data->scalarVal();
             }
         }
         $result[] = $out;
@@ -165,16 +165,16 @@ for ($i = 0; $i < $num_tests; $i++) {
     $response = $dummy->ParseResponse($in, true);
     $value = $response->value();
     $result = array();
-    $l = $value->arraysize();
+    $l = $value->arraySize();
     for ($k = 0; $k < $l; $k++) {
-        $val1 = $value->arraymem($k);
+        $val1 = $value->arrayMem($k);
         $out = array();
         foreach($val1 as $name => $val) {
             $out[$name] = array();
-            $m = $val->arraysize();
+            $m = $val->arraySize();
             for ($j = 0; $j < $m; $j++) {
-                $data = $val->arraymem($j);
-                $out[$name][] = $data->scalarval();
+                $data = $val->arrayMem($j);
+                $out[$name][] = $data->scalarVal();
             }
         } // while
         $result[] = $out;
@@ -184,7 +184,7 @@ end_test('Data decoding (large array)', 'manual decoding deprecated', $result);
 
 begin_test('Data decoding (large array)', 'automatic decoding');
 for ($i = 0; $i < $num_tests; $i++) {
-    $response = $dummy->ParseResponse($in, true, 'phpvals');
+    $response = $dummy->parseResponse($in, true, 'phpvals');
     $value = $response->value();
 }
 end_test('Data decoding (large array)', 'automatic decoding', $value);
@@ -192,7 +192,7 @@ end_test('Data decoding (large array)', 'automatic decoding', $value);
 if (function_exists('xmlrpc_decode')) {
     begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
     for ($i = 0; $i < $num_tests; $i++) {
-        $response = $dummy->ParseResponse($in, true, 'xml');
+        $response = $dummy->parseResponse($in, true, 'xml');
         $value = xmlrpc_decode($response->value());
     }
     end_test('Data decoding (large array)', 'xmlrpc-epi decoding', $value);