From 005122af46b07461155864131e9378aac42a931a Mon Sep 17 00:00:00 2001 From: gggeek Date: Wed, 1 Feb 2023 17:20:46 +0000 Subject: [PATCH] nitpicks --- demo/client/parallel.php | 15 ++++++++------- extras/benchmark.php | 16 ++++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/demo/client/parallel.php b/demo/client/parallel.php index f7853160..26ba1f3f 100644 --- a/demo/client/parallel.php +++ b/demo/client/parallel.php @@ -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; diff --git a/extras/benchmark.php b/extras/benchmark.php index 7cb44eb7..c064bc87 100644 --- a/extras/benchmark.php +++ b/extras/benchmark.php @@ -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); -- 2.47.0