We are doing expensive calculations (parsing large XML feeds)
and experience shows that the whole browser window hangs for
seconds while doing that. We prepared for this by displaying an
AJAX loading icon for the user but even that stops animating.
My question is if it is possible to somehow give the focus
back to the browser so that it can update the display within our
large loop. I think this is possible in general low-level desktop
programming but not in a browser environment.
Do you have any ideas other than using a "timer" and doing
the calculation "asynchronously"? It would be a pain to rewrite
this function into smaller substeps.
I don't think there's any other way than to make your
function pseudo-threadable and execute it in parts using setTimeout
(if you're doing HTML air app dev).
processing (take code.google.com's syntax highlighting) do it the
same way. That's currently the only way to prevent the UI from
FYI, I discovered that it's actually not the XML parsing that
takes most of the time but database operations and function calls.
Parsing an 500k XML feed seems to take less than a second on my 2
year old laptop.