Notice this line in /resources/src/mediawiki.action/mediawiki.action.history.js:
$lis.find( 'input[name="diff"], input[name="oldid"]' ).on( 'click', updateDiffRadios );
It binds two event listeners for every history line. It isn't scalable and can get huge.
For perspective: a default 50-line page will already have 100 listeners, displaying 500 lines will bind 1000 listeners.… (and I even have a custom script to display 5000 lines at once, that binds 10000 listeners!)
Instead, we could take advantage of jQuery's delegated event handlers, so that only one event listener is bound (to the history container), independently from the number of lines.