I need to store lots of two-dimensional arrays inside database and was not sure what to use: serialize
or implode
. So I did a few tests, to find out which one is working faster and came to the conclusion it was serialize
:
Execution times: 1'000'000
Serialize: 1.4974119663239 seconds
Implode: 2.5333571434021 seconds
Explode: 4.0185871124268 seconds
Unserialize: 1.6835169792175 seconds
So the question: Why is implode+explode so much slower then serialize+unserialize?
PS: I found this question already, but it is not exactly what I am asking.