PHP - *fast* serialize/unserialize?

前端 未结 8 1730
死守一世寂寞
死守一世寂寞 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:19

    It seems that the answer to your question is no.

    Even if you discover a "binary serialization format" option most likely even that would be to slow for what you envisage.

    So, what you may have to look into using (as others have mentioned) is a database, memcached, or on online web service.

    I'd like to add the following ideas as well:

    • caching of requests/responses
    • your PHP script does not shutdown but becomes a network server to answer queries
    • or, dare I say it, change the data structure and method of query you are currently using

提交回复
热议问题