Open tholden92 opened 4 years ago
I second this. This is an absolute show-stopper for me. This extension makes every single call to PHP on the command line take several seconds, when normally it takes milliseconds. Even running php -m
just to verify if php-postal is enabled takes forever.
Did I miss something? I thought I installed both libpostal and php-postal exactly as it says. And they work on my machine, but are just so doggedly slow. What can be done about this?
This may not work in your environment, but we just made a small network service using https://github.com/openvenues/gopostal and call it when we need to parse a location.
I ended up doing the exact same thing. Wrote a c++ program exposing libpostal over sockets. Thanks for the suggestion though.
Chiming in to say I'm seeing the same thing, even when not directly using Postal functionality.
Enabled:
$ time php -v
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans
real 0m4.449s
user 0m3.296s
sys 0m1.132s
Disabled:
$ time php -v
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans
real 0m0.021s
user 0m0.012s
sys 0m0.009s
4 seconds to run php -v
is far from ideal. This would make my whole API server somewhere around 20x slower.
This is a Docker container that provides a REST API to libpostal: https://github.com/johnlonganecker/libpostal-rest-docker (I saw it mentioned in https://github.com/openvenues/php-postal/issues/15#issuecomment-51305913.)
Otherwise, maybe a PHP socket server could work, similar to what @tholden92 says he did with C++.
Any update on this, on my system its taking over 20seconds to try and run a php script when this extension is enabled
Hello
Is it possible to use this php extension in such a way that you can avoid the warm up time when doing address_parse() ?
I initially thought that it would work to run the parsing in a while loop accepting addresses to parse, and only have the warmup happen initially, but seems I was wrong?