Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warm up time #20

Open
tholden92 opened this issue Nov 19, 2019 · 7 comments
Open

Warm up time #20

tholden92 opened this issue Nov 19, 2019 · 7 comments

Comments

@tholden92
Copy link

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?

@curtisdf
Copy link

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?

@stevenscg
Copy link

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.

@tholden92
Copy link
Author

I ended up doing the exact same thing. Wrote a c++ program exposing libpostal over sockets.
Thanks for the suggestion though.

@enobrev
Copy link

enobrev commented Oct 7, 2020

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.

@LordPachelbel
Copy link

This is a Docker container that provides a REST API to libpostal: https://github.com/johnlonganecker/libpostal-rest-docker
(I saw it mentioned in #15 (comment).)

Otherwise, maybe a PHP socket server could work, similar to what @tholden92 says he did with C++.

@dorgan
Copy link

dorgan commented Jan 12, 2022

Any update on this, on my system its taking over 20seconds to try and run a php script when this extension is enabled

@tm1000
Copy link

tm1000 commented Mar 17, 2023

#30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants