I wrote a module for MODx using Ajax, it worked on dev server quite well but when I moved it online, one particular request got quite slow. This request generates around
120kB text but the weird thing is that what makes the request slow is
printing, not generating. I used Firebug to measure the times. The request took
~100ms without printing the results, but
~400ms with printing... so the simple last
echo command took itself
300ms! To find out more about this behaviour I just let the module print some pregenerated text of the same size without generating. Really just echo "120kB text". The request still took around 400ms. But then I run the script outside the MODx and suddenly it got really fast - just ~20ms!
So I suppose that MODx "does" some stuff around with the module output and makes it so slow. I tried to call exit right after the echo to stop the script but it didn't help.
I'm using MODx Evolution.