php basex

Monday, 23 July 2018 · 9 messages
ВВ
Ветошкин Владимир23 Jul 2018 10:39 #
Hi! One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? In GUI - 2.5-3sec, in PHP - 8-10sec.
-- С уважением, Ветошкин Владимир Владимирович
CG
Christian Grün23 Jul 2018 10:53 #
Quoted text · Ветошкин Владимир · 2 lines
> One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > In GUI - 2.5-3sec, in PHP - 8-10sec.
There are too many factors that influence execution time (bandwidth, result size, etc.), so you will need to provide us with more information, such as a minimized code example that demonstrates your observations. Instead of providing your original data, you could e.g. write a little self-contained XQuery expression that creates data of the same size.
ВВ
Ветошкин Владимир23 Jul 2018 11:24 #
Probably, it's because of the result size (~1.5mb).
When I reduce the count of the returning data - execution time decreases.
The php-code of measuring execution time:
$time_start = microtime(true);
while ($query->more()) {
$q = $query->next();
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start);
echo $execution_time;
I'll try to do this:
Quoted text · Christian Grün · 11 lines
>> you could e.g. write a little self-contained XQuery expression that creates data of the same size. 23.07.2018, 11:53, "Christian Grün" <christian.gruen at gmail.com>: > > One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > > In GUI - 2.5-3sec, in PHP - 8-10sec. > > There are too many factors that influence execution time (bandwidth, > result size, etc.), so you will need to provide us with more > information, such as a minimized code example that demonstrates your > observations. Instead of providing your original data, you could e.g. > write a little self-contained XQuery expression that creates data of > the same size.
-- С уважением, Ветошкин Владимир Владимирович
ВВ
Ветошкин Владимир23 Jul 2018 11:32 #
The query:
for $i in (1 to 500000)
return $i
In GUI: 200ms In PHP: 25sec. it is because of the result size, is it?
Quoted text · Ветошкин Владимир · 34 lines
23.07.2018, 12:24, "Ветошкин Владимир" <en-trance at yandex.ru>: > Probably, it's because of the result size (~1.5mb). > When I reduce the count of the returning data - execution time decreases. > The php-code of measuring execution time: > $time_start = microtime(true); > while ($query->more()) { > $q = $query->next(); > } > $time_end = microtime(true); > $execution_time = ($time_end - $time_start); > echo $execution_time; > > I'll try to do this: > >> you could e.g. write a little self-contained XQuery expression that creates data of the same size. > > > > 23.07.2018, 11:53, "Christian Grün" <christian.gruen at gmail.com>: > > > > One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > > > In GUI - 2.5-3sec, in PHP - 8-10sec. > > > > There are too many factors that influence execution time (bandwidth, > > result size, etc.), so you will need to provide us with more > > information, such as a minimized code example that demonstrates your > > observations. Instead of providing your original data, you could e.g. > > write a little self-contained XQuery expression that creates data of > > the same size. > > > -- > С уважением, > Ветошкин Владимир Владимирович >
-- С уважением, Ветошкин Владимир Владимирович
CG
Christian Grün23 Jul 2018 11:44 #
Hi Vladimir, Thanks for the example. This is quite an impressive difference indeed. Two more questions: 1. What is the execution time for running string-join(1 to 500000, out:nl()) ? 2. What are the execution times in PHP when running a) execute('xquery ...') b) query('...') and more()/next() ? I don’t know much about PHP. Maybe there are simple ways to improve the performance of our client [1]? Suggestions are welcome. Best, Christian [1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/php/BaseXClient.php
Quoted text · Ветошкин Владимир · 55 lines
On Mon, Jul 23, 2018 at 11:35 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > The query: > for $i in (1 to 500000) > return $i > > In GUI: 200ms > In PHP: 25sec. > > it is because of the result size, is it? > > > 23.07.2018, 12:24, "Ветошкин Владимир" <en-trance at yandex.ru>: > > Probably, it's because of the result size (~1.5mb). > When I reduce the count of the returning data - execution time decreases. > The php-code of measuring execution time: > $time_start = microtime(true); > while ($query->more()) { > $q = $query->next(); > } > $time_end = microtime(true); > $execution_time = ($time_end - $time_start); > echo $execution_time; > > I'll try to do this: > >> you could e.g. write a little self-contained XQuery expression that creates data of the same size. > > > 23.07.2018, 11:53, "Christian Grün" <christian.gruen at gmail.com>: > > One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > In GUI - 2.5-3sec, in PHP - 8-10sec. > > > There are too many factors that influence execution time (bandwidth, > result size, etc.), so you will need to provide us with more > information, such as a minimized code example that demonstrates your > observations. Instead of providing your original data, you could e.g. > write a little self-contained XQuery expression that creates data of > the same size. > > > > -- > С уважением, > Ветошкин Владимир Владимирович > > > > > -- > С уважением, > Ветошкин Владимир Владимирович >
ВВ
Ветошкин Владимир23 Jul 2018 12:04 #
1. in GUI ~200ms, in PHP ~17sec 2a. ~23sec 2b. ~17sec
Quoted text · Christian Grün · 1 line
>> Maybe there are simple ways to improve the performance of our client [1]?
Maybe... I'll try to explore this issue better.
Quoted text · Christian Grün · 77 lines
23.07.2018, 12:44, "Christian Grün" <christian.gruen at gmail.com>: > Hi Vladimir, > > Thanks for the example. This is quite an impressive difference indeed. > Two more questions: > > 1. What is the execution time for running string-join(1 to 500000, out:nl()) ? > > 2. What are the execution times in PHP when running > a) execute('xquery ...') > b) query('...') and more()/next() ? > > I don’t know much about PHP. Maybe there are simple ways to improve > the performance of our client [1]? Suggestions are welcome. > > Best, > Christian > > [1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/php/BaseXClient.php > > > > On Mon, Jul 23, 2018 at 11:35 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > > The query: > > for $i in (1 to 500000) > > return $i > > > > In GUI: 200ms > > In PHP: 25sec. > > > > it is because of the result size, is it? > > > > > > 23.07.2018, 12:24, "Ветошкин Владимир" <en-trance at yandex.ru>: > > > > Probably, it's because of the result size (~1.5mb). > > When I reduce the count of the returning data - execution time decreases. > > The php-code of measuring execution time: > > $time_start = microtime(true); > > while ($query->more()) { > > $q = $query->next(); > > } > > $time_end = microtime(true); > > $execution_time = ($time_end - $time_start); > > echo $execution_time; > > > > I'll try to do this: > > >> you could e.g. write a little self-contained XQuery expression that creates data of the same size. > > > > > > 23.07.2018, 11:53, "Christian Grün" <christian.gruen at gmail.com>: > > > > One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > > In GUI - 2.5-3sec, in PHP - 8-10sec. > > > > > > There are too many factors that influence execution time (bandwidth, > > result size, etc.), so you will need to provide us with more > > information, such as a minimized code example that demonstrates your > > observations. Instead of providing your original data, you could e.g. > > write a little self-contained XQuery expression that creates data of > > the same size. > > > > > > > > -- > > С уважением, > > Ветошкин Владимир Владимирович > > > > > > > > > > -- > > С уважением, > > Ветошкин Владимир Владимирович > >
-- С уважением, Ветошкин Владимир Владимирович
CG
Christian Grün23 Jul 2018 12:18 #
Quoted text · Ветошкин Владимир · 3 lines
> 1. in GUI ~200ms, in PHP ~17sec > 2a. ~23sec > 2b. ~17sec
I see. So this clearly indicates that it’s the result size (the number of results has an effect as well, but it doesn’t seem to be that dominant). The Java client is much faster indeed. I assume you have communicated with your local BaseX instance?
Quoted text · Ветошкин Владимир · 90 lines
> >> Maybe there are simple ways to improve the performance of our client [1]? > Maybe... I'll try to explore this issue better. > > 23.07.2018, 12:44, "Christian Grün" <christian.gruen at gmail.com>: > > Hi Vladimir, > > Thanks for the example. This is quite an impressive difference indeed. > Two more questions: > > 1. What is the execution time for running string-join(1 to 500000, out:nl()) ? > > 2. What are the execution times in PHP when running > a) execute('xquery ...') > b) query('...') and more()/next() ? > > I don’t know much about PHP. Maybe there are simple ways to improve > the performance of our client [1]? Suggestions are welcome. > > Best, > Christian > > [1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/php/BaseXClient.php > > > > On Mon, Jul 23, 2018 at 11:35 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > > > The query: > for $i in (1 to 500000) > return $i > > In GUI: 200ms > In PHP: 25sec. > > it is because of the result size, is it? > > > 23.07.2018, 12:24, "Ветошкин Владимир" <en-trance at yandex.ru>: > > Probably, it's because of the result size (~1.5mb). > When I reduce the count of the returning data - execution time decreases. > The php-code of measuring execution time: > $time_start = microtime(true); > while ($query->more()) { > $q = $query->next(); > } > $time_end = microtime(true); > $execution_time = ($time_end - $time_start); > echo $execution_time; > > I'll try to do this: > >> you could e.g. write a little self-contained XQuery expression that creates data of the same size. > > > 23.07.2018, 11:53, "Christian Grün" <christian.gruen at gmail.com>: > > One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > In GUI - 2.5-3sec, in PHP - 8-10sec. > > > There are too many factors that influence execution time (bandwidth, > result size, etc.), so you will need to provide us with more > information, such as a minimized code example that demonstrates your > observations. Instead of providing your original data, you could e.g. > write a little self-contained XQuery expression that creates data of > the same size. > > > > -- > С уважением, > Ветошкин Владимир Владимирович > > > > > -- > С уважением, > Ветошкин Владимир Владимирович > > > > > -- > С уважением, > Ветошкин Владимир Владимирович >
ВВ
Ветошкин Владимир23 Jul 2018 12:36 #
Quoted text · Christian Grün · 1 line
>> I assume you have communicated with your local BaseX instance?
Yes, $session = new Session("localhost", $this->dbport, $this->dblogin, $this->dbpass);
Quoted text · Christian Grün · 102 lines
23.07.2018, 13:19, "Christian Grün" <christian.gruen at gmail.com>: > > 1. in GUI ~200ms, in PHP ~17sec > > 2a. ~23sec > > 2b. ~17sec > > I see. So this clearly indicates that it’s the result size (the number > of results has an effect as well, but it doesn’t seem to be that > dominant). The Java client is much faster indeed. I assume you have > communicated with your local BaseX instance? > > > > > >> Maybe there are simple ways to improve the performance of our client [1]? > > Maybe... I'll try to explore this issue better. > > > > 23.07.2018, 12:44, "Christian Grün" <christian.gruen at gmail.com>: > > > > Hi Vladimir, > > > > Thanks for the example. This is quite an impressive difference indeed. > > Two more questions: > > > > 1. What is the execution time for running string-join(1 to 500000, out:nl()) ? > > > > 2. What are the execution times in PHP when running > > a) execute('xquery ...') > > b) query('...') and more()/next() ? > > > > I don’t know much about PHP. Maybe there are simple ways to improve > > the performance of our client [1]? Suggestions are welcome. > > > > Best, > > Christian > > > > [1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/php/BaseXClient.php > > > > > > > > On Mon, Jul 23, 2018 at 11:35 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > > > > > > > The query: > > for $i in (1 to 500000) > > return $i > > > > In GUI: 200ms > > In PHP: 25sec. > > > > it is because of the result size, is it? > > > > > > 23.07.2018, 12:24, "Ветошкин Владимир" <en-trance at yandex.ru>: > > > > Probably, it's because of the result size (~1.5mb). > > When I reduce the count of the returning data - execution time decreases. > > The php-code of measuring execution time: > > $time_start = microtime(true); > > while ($query->more()) { > > $q = $query->next(); > > } > > $time_end = microtime(true); > > $execution_time = ($time_end - $time_start); > > echo $execution_time; > > > > I'll try to do this: > > >> you could e.g. write a little self-contained XQuery expression that creates data of the same size. > > > > > > 23.07.2018, 11:53, "Christian Grün" <christian.gruen at gmail.com>: > > > > One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > > In GUI - 2.5-3sec, in PHP - 8-10sec. > > > > > > There are too many factors that influence execution time (bandwidth, > > result size, etc.), so you will need to provide us with more > > information, such as a minimized code example that demonstrates your > > observations. Instead of providing your original data, you could e.g. > > write a little self-contained XQuery expression that creates data of > > the same size. > > > > > > > > -- > > С уважением, > > Ветошкин Владимир Владимирович > > > > > > > > > > -- > > С уважением, > > Ветошкин Владимир Владимирович > > > > > > > > > > -- > > С уважением, > > Ветошкин Владимир Владимирович > >
-- С уважением, Ветошкин Владимир Владимирович
ВВ
Ветошкин Владимир23 Jul 2018 14:36 #
There is something strange... socket_recv executes much longer than socket_read.. For this: string-join(1 to 100000, out:nl()) socket_recv takes ~3sec socket_read takes ~1-3ms I don't understand why...
Quoted text · Ветошкин Владимир · 115 lines
23.07.2018, 13:37, "Ветошкин Владимир" <en-trance at yandex.ru>: > >> I assume you have communicated with your local BaseX instance? > Yes, > $session = new Session("localhost", $this->dbport, $this->dblogin, $this->dbpass); > > > 23.07.2018, 13:19, "Christian Grün" <christian.gruen at gmail.com>: > > > > 1. in GUI ~200ms, in PHP ~17sec > > > 2a. ~23sec > > > 2b. ~17sec > > > > I see. So this clearly indicates that it’s the result size (the number > > of results has an effect as well, but it doesn’t seem to be that > > dominant). The Java client is much faster indeed. I assume you have > > communicated with your local BaseX instance? > > > > > > > > > >> Maybe there are simple ways to improve the performance of our client [1]? > > > Maybe... I'll try to explore this issue better. > > > > > > 23.07.2018, 12:44, "Christian Grün" <christian.gruen at gmail.com>: > > > > > > Hi Vladimir, > > > > > > Thanks for the example. This is quite an impressive difference indeed. > > > Two more questions: > > > > > > 1. What is the execution time for running string-join(1 to 500000, out:nl()) ? > > > > > > 2. What are the execution times in PHP when running > > > a) execute('xquery ...') > > > b) query('...') and more()/next() ? > > > > > > I don’t know much about PHP. Maybe there are simple ways to improve > > > the performance of our client [1]? Suggestions are welcome. > > > > > > Best, > > > Christian > > > > > > [1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/php/BaseXClient.php > > > > > > > > > > > > On Mon, Jul 23, 2018 at 11:35 AM Ветошкин Владимир <en-trance at yandex.ru> wrote: > > > > > > > > > > > > The query: > > > for $i in (1 to 500000) > > > return $i > > > > > > In GUI: 200ms > > > In PHP: 25sec. > > > > > > it is because of the result size, is it? > > > > > > > > > 23.07.2018, 12:24, "Ветошкин Владимир" <en-trance at yandex.ru>: > > > > > > Probably, it's because of the result size (~1.5mb). > > > When I reduce the count of the returning data - execution time decreases. > > > The php-code of measuring execution time: > > > $time_start = microtime(true); > > > while ($query->more()) { > > > $q = $query->next(); > > > } > > > $time_end = microtime(true); > > > $execution_time = ($time_end - $time_start); > > > echo $execution_time; > > > > > > I'll try to do this: > > > >> you could e.g. write a little self-contained XQuery expression that creates data of the same size. > > > > > > > > > 23.07.2018, 11:53, "Christian Grün" <christian.gruen at gmail.com>: > > > > > > One thing puzzles me. Why does the same query take different execution time in GUI and PHP ? > > > In GUI - 2.5-3sec, in PHP - 8-10sec. > > > > > > > > > There are too many factors that influence execution time (bandwidth, > > > result size, etc.), so you will need to provide us with more > > > information, such as a minimized code example that demonstrates your > > > observations. Instead of providing your original data, you could e.g. > > > write a little self-contained XQuery expression that creates data of > > > the same size. > > > > > > > > > > > > -- > > > С уважением, > > > Ветошкин Владимир Владимирович > > > > > > > > > > > > > > > -- > > > С уважением, > > > Ветошкин Владимир Владимирович > > > > > > > > > > > > > > > -- > > > С уважением, > > > Ветошкин Владимир Владимирович > > > > > > -- > С уважением, > Ветошкин Владимир Владимирович >
-- С уважением, Ветошкин Владимир Владимирович

⚡Generated with XQuery