performance - PHP $_POST vs saving data in an array -
this question has answer here:
- is micro-optimization worth time? 9 answers
this not bug or issue. while reading lot of performance realated articles came know how javascript variables take more resources load , better put global variable javascript local variable work - specially in loops.
so wondering if such thing happens on $_post php. in give me performance improvement if have lot of post data. save in local array $post_data = $_post;
and reference in required.
not worth time. $_post
array in memory, no need duplicate it.
to size of $_post
in bytes, can this:
strlen(serialize($_post));
(serialize
turn object string can saved , unserialize
d. )
fwiw in for
loops, if don't cache length of array , instead use this...
for(var = 0; < myarray.length; i++) {}
...js have recalculate .length
each time starts iteration, it's expensive, particularly on big arrays.
Comments
Post a Comment