gTImer will let you time your javascript functions, trace time inside the loop, ajax time and practically for any logic and get the time logs as a json