There is a function to guess what users like. Users can refresh the recommended content by clicking to change a group. First query the database to get the first 1000 pieces of data, and then randomly remove 4 pieces. After I finished writing the program, I found that it ran very slowly. Every time I refreshed it, I had to wait a long time for it to come out. The code is as follows:
The above writing method must be sorted after using unset. unset will only delete the key value, but the key will be retained. The improved writing is as follows:
Efficiency increased by 3-4 times. |