PHP - *fast* serialize/unserialize?

前端 未结 8 1729
死守一世寂寞
死守一世寂寞 2021-02-19 04:54

I have a PHP script that builds a binary search tree over a rather large CSV file (5MB+). This is nice and all, but it takes about 3 seconds to read/parse/index the file.

<
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-19 05:20

    If you want speed, writing to or reading from the file system in less than optimal.

    In most cases, a database server will be able to store and retrieve data much more efficiently than a PHP script that is reading/writing files.

    Another possibility would be something like Memcached.

    Object serialization is not known for its performance but for its ease of use and it's definitely not suited to handle large amounts of data.

提交回复
热议问题