Calcatraz, the Fast Online Calculator
Recently a number of changes I made to the calculator have been causing a bit of a performance hit. To counteract that I’ve been through and made a few simple changes:
- Removed some external file includes which were no longer needed
- Implemented better caching to prevent unnecessary re-requests
- Modified the core to minimise the amount of work being performed in the most-frequently used code.
The last of these required some profiling to be performed. For this I used webgrind for PHP (which requires xdebug to be installed, which I did on my local testing environment). While this set-up was a bit fiddly to get going, it was worth it as it let me pinpoint exactly where performance was being the most affected. As a result I was able to cut calculation time down from 2.5 to around 0.5 seconds on average. The result is faster page loads every time.

