I am not very sure if this is the hardest bug - lets say this is my recent hardest bug I dealt with.
I was working on a page that made heavy use of jQuery and used dynamic visualization tools to represent data in various formats : donut charts and sortable, searchable, editable tables. This page had about 21,000 lines of code separated into partials using handlebars. Initially, the page took 4.53s to load.I debugged every section of this page and implemented all sorts of performance improvement measures to reduce the page load time to less than 1s.
This part of my job was an eye opener for me in the sense how all the common programming mistakes committed earlier , when combined together in a page, were able to make such an impact on the performance.
Some highlights were: