php array_intersect() efficiency

前端 未结 5 1843
旧时难觅i
旧时难觅i 2020-12-03 22:38

consider the below script. two arrays with only three values.when i compare these two arrays using array_intersect(). the result is fast.

    

        
5条回答
  •  既然无缘
    2020-12-03 23:15

    From what you state above, I would recommend you to implement a caching mechanism. That way you would of load the DB and speed up your application. I would also recommend you to profile the speed of array_intersect with increasing amount of data to see how performance scale. You could do this by simply wrapping the call in calls for the system time and calculate the difference. But I would recommend you to use a real profiler to get good data.

提交回复
热议问题