Php performance (memory) problem author: zccst encountered such a problem $ retArrarray (); order of magnitude: one of the ten hundred fields is the model, model array that meets the criteria $ modelArrarray (); order of magnitude: one of the thousands fields is sn, and the sn array of the complex condition $ snArrarray (); order of magnitude: 0.1 million question: $ modelArr contains sn information, but it is necessary to judge the php performance (memory) problem
Author: zccst
This problem occurs.
$ RetArr = array (); // magnitude: 10/Hundred
One of the fields is the model and an array of qualified models.
$ ModelArr = array (); // magnitude: Thousands
One of the fields is sn, and the sn array of the complex condition
$ SnArr = array (); // order of magnitude: 0.1 million
$ ModelArr contains sn information, but you need to determine whether the sn is in $ snArr. if it is in, it indicates a compound condition. if it is not in, it indicates that the condition is not met (for example, it is not online ).
Problem: 0.1 million * 1000*100 = 10 billion of data, resulting in insufficient memory.
Solution 1: Use in_array ($ key, $ destArr );
The actual operation found that the memory is insufficient.
Solution 2: use SQL queries.
Feasible, but it takes 1-2 minutes to run. The default timeout value of front-end ExtJs is 30 seconds, so the default timeout value is 5 minutes. The problem is solved.