When using php to call a python program to process data, it is found that the speed is too slow. It takes about 1 m40s to run. However, it takes about five seconds to run the python program directly on the server. The results of the two are the same. It is really unclear why php takes such a long time to process data... It is found that the speed is too slow when the python program is called through php. It takes about 1 m40s to run. However, it takes about five seconds to run the python program directly on the server.
The results of the two are the same. It is really unclear why php is used for such a long time. Try to call python asynchronously, that is, the PHP file contains the following code:
result.json &');?>
The same result is true, but it is still slow. Does anyone know how to do this, or how to find out what php is doing?
To answer this question, it still does not solve the problem of slow python calling.
But the key to finding the problem is that a file of 80 + mb is read in the python program. The solution is to split the file into small files and access only the desired file each time, so that you do not need to read all the information.
This operation speed is acceptable. Does anyone know why it is slow to open large files using php to call python?
Reply content:
When using php to call a python program to process data, it is found that the speed is too slow. It takes about 1 m40s to run. However, it takes about five seconds to run the python program directly on the server.
The results of the two are the same. It is really unclear why php is used for such a long time. Try to call python asynchronously, that is, the PHP file contains the following code:
result.json &');?>
The same result is true, but it is still slow. Does anyone know how to do this, or how to find out what php is doing?
To answer this question, it still does not solve the problem of slow python calling.
But the key to finding the problem is that a file of 80 + mb is read in the python program. The solution is to split the file into small files and access only the desired file each time, so that you do not need to read all the information.
This operation speed is acceptable. Does anyone know why it is slow to open large files using php to call python?
Is it asynchronous? How do I rememberPHP
All are synchronized...