When IE8 displays a warning, it is not because of the time scripts take to run but rather the number of statements within the script. This warning can sometimes be misleading.
The default threshold limit for the time-out dialog box in IE8 is set at 5,000,000 statements. However, Microsoft has released a patch that addresses this issue: http://support.microsoft.com/kb/175500
If you need to increase this threshold beyond the default limit, Microsoft provides instructions on how to do so through a registry entry:
To modify the threshold value, use a Registry Editor like Regedt32.exe
and navigate to the key: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles. If the Styles key does not exist, create a new one.
Create a new DWORD value called "MaxScriptStatements" under this key and assign it the desired number of script statements.
If unsure about the appropriate value to set, you can simply input a DWORD value of 0xFFFFFFFF to prevent the dialog box from appearing.
In addressing a similar issue with Angular and IE8, I found success in reducing object sizes and rethinking the architecture of the application while also applying the aforementioned patch. Dealing with limitations inherent in supporting IE8, our team transitioned to using lighter UI frameworks and custom controls only when necessary.
I hope this information proves helpful, especially if you are grappling with IE8 compatibility as well!