AJAX performance

Im having a slow AJAX performance when calling events. The events are some arithmetic exercises.
Anyone else having a slow AJAX performance? any idea how to get it faster?

Try moving the math into a php method and call the php method from the ajax event (just a suggestion I have complex calculations going on and that’s how I do it)