javascript - Avoiding the "script is running too long" dialog, should I split up my function and run it at intervals? -


i have large javasscript loop running on 1 of pages. large causing ie popup in old versions says like: 'a script of page making run slow, want terminate it?'

i'm confident have optimized as possible i'm looking alternate ways it.

i'm wondering whether beneficial me create interval ran first 100 iterations, second 100 iterations, third , on until iterations complete? prevent ie popup claiming scripts running slow?

the "script long" browser popup appear time code doesn't yield control browser's main event processing loop enough.

using settimeout suggest in question trigger calculations in batches indeed prevent popup appearing.

yielding event loop periodically allow browser remain responsive other ui events - (for example) offer "cancel" button. suggest try yield @ least once second, if not more that.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -