3 ms·
What is your problem with startup time? Have you timed it? How long does it take? PHP starts up from scratch on every request, yet it blows Python out of the w
by TekMol 3y ago
What is your problem with startup time? Have you timed it? How long does it take?
PHP starts up from scratch on every request, yet it blows Python out of the water performance wise.
- Thews 3y agoIt's been a while since I've seen anyone brag about PHP's speed. PHP is quite slow at encoding and decoding JSON, very slow at any kind of tree data structure, and has among the highest memory usage of any language at printing a string of text to a console or otherwise. Python is faster at all of those things and it's quite slow. Those are kind of web related tasks, and the web benchmarks for say django vs laravel don't show that PHP is any kind of winner.
- VectorLock 3y agoIf he think's CGI startup time is acceptable then I guess maybe PHP seems fast then?
- Thews 3y agoMy bigger issue with the CGI model is the lack of handling connections as streaming. You can't parse a file while it's still being uploaded, and that can eat up a lot of memory on larger files. I know startup times can take a toll like establishing db connections, cache checking (like redis), file imports, etc. If you are using something that starts up for every request, then you have to be aware of those kinds of things and design around them.
- aidos 3y agoBy the time everything is imported and running you can be into the territory of really not wanting to do it on every request. I’ve not timed it in my case for a while but you’re definitely looking at 100s or 1000s of ms.
- eesmith 3y ago> Have you timed it? I literally gave a timing number in my comment. The >1 second time was for a very unusual circumstance. Unless you timed PHP startup time using straight CGI (not mod_cgi, nor FastCGI) on a Lustre file system about 15 years ago, with the appropriate set of extensions enabled for what our application needed, you can't really compare the two. > PHP starts up from scratch on every request Congratulations. Now getting back to your request to "Name one", the PHP documentation at https://www.php.net/manual/en/install.unix.commandline.php https://www.php.net/manual/en/install.unix.commandline.php gives essentially the same answer as I did: "By default, PHP is built as both a CLI and CGI program, which can be used for CGI processing. If you are running a web server that PHP has module support for, you should generally go for that solution for performance reasons."
- VectorLock 3y agoEven to execute the most minimal binary fork/execve takes a not insignificant amount of time. Thats one of the reasons why CGI fell by the wayside.