i'm having trouble with modifying the location hash in IE8 for XP. simply calling:
self.location.hash = "whatever"
takes about 800ms~1800ms
I have no idea what can slow this down. I checked the same instruction on some other sites and it's not that slow.
Any clues what can make it so slow ? I am sorry but I can't give an online example.
EDIT: Here's What I get in the IE console, input:
console.log( new Date().getTime() );
self.location.hash = "sfdsd";
console.log( new Date().getTime() );
output:
JOURNAL : 1326468325447
JOURNAL : 1326468327390
undefined
which makes almost 2000ms, if I read correctly, for a single assignation :/ .
EDIT2: since it doesn't seem clear enough, more preofiled code:
var profileThat = function() {self.location.hash = "whatever"};
$('#keywatchHeader').click( profileThat );
profiler results with two clicks:
profileThat 2 3475,00 3475,00 hidden 4 50,07 50,07 http://192.168.0.30/kw5/js/jquery/jquery-1.6.2.js 6 608 eventHandle 8 3525,07 40,06 http://192.168.0.30/kw5/js/jquery/jquery-1.6.2.js 2 595 get 4 20,03 20,03 http://192.168.0.30/kw5/js/jquery/jquery-1.6.2.js 6 419 get 6 10,01 10,01 http://192.168.0.30/kw5/js/yui2/dom/dom.js 96
EDIT3:
I ran some tests on node number on tree out of curiosity and results are surprising. After such a call:
document.getElementsByTagName('*').length; //3621
$('#keywatchPanels').children().remove();
document.getElementsByTagName('*').length; //332
after that the profiler gives 600ms instead of 1700ms per call! But I hardly with node number would influence hashtag writing.
(edit4):I've found this related question: Why is this piece of Javascript code so slow? (but the answer here is just "remove it")
i'm having trouble with modifying the location hash in IE8 for XP. simply calling:
self.location.hash = "whatever"
takes about 800ms~1800ms
I have no idea what can slow this down. I checked the same instruction on some other sites and it's not that slow.
Any clues what can make it so slow ? I am sorry but I can't give an online example.
EDIT: Here's What I get in the IE console, input:
console.log( new Date().getTime() );
self.location.hash = "sfdsd";
console.log( new Date().getTime() );
output:
JOURNAL : 1326468325447
JOURNAL : 1326468327390
undefined
which makes almost 2000ms, if I read correctly, for a single assignation :/ .
EDIT2: since it doesn't seem clear enough, more preofiled code:
var profileThat = function() {self.location.hash = "whatever"};
$('#keywatchHeader').click( profileThat );
profiler results with two clicks:
profileThat 2 3475,00 3475,00 hidden 4 50,07 50,07 http://192.168.0.30/kw5/js/jquery/jquery-1.6.2.js 6 608 eventHandle 8 3525,07 40,06 http://192.168.0.30/kw5/js/jquery/jquery-1.6.2.js 2 595 get 4 20,03 20,03 http://192.168.0.30/kw5/js/jquery/jquery-1.6.2.js 6 419 get 6 10,01 10,01 http://192.168.0.30/kw5/js/yui2/dom/dom.js 96
EDIT3:
I ran some tests on node number on tree out of curiosity and results are surprising. After such a call:
document.getElementsByTagName('*').length; //3621
$('#keywatchPanels').children().remove();
document.getElementsByTagName('*').length; //332
after that the profiler gives 600ms instead of 1700ms per call! But I hardly with node number would influence hashtag writing.
(edit4):I've found this related question: Why is this piece of Javascript code so slow? (but the answer here is just "remove it")
Share Improve this question edited May 23, 2017 at 10:24 CommunityBot 11 silver badge asked Jan 13, 2012 at 13:17 BiAiBBiAiB 14.1k11 gold badges46 silver badges64 bronze badges 8- How large is your page? Any other code that is running checking the hash? – epascarello Commented Jan 13, 2012 at 13:21
- what do you mean exactly by large ? pixel width, weight,elements? There is the YUI2 history manager which is checking the hash but it's solely this instruction who sucks that much time, whether I exect it in code, or console. – BiAiB Commented Jan 13, 2012 at 13:24
- I can't reproduce that. Takes around 100ms here on IE8.0.6001.18702. How did you measure the performance? Did you use the IE script profiler? – user123444555621 Commented Jan 13, 2012 at 14:23
- both by IE script profiler and "perception". It literaly takes a second from time I hit enter in the console, and the time the result e. Same when I debug step by step. As I said, I tried on other sites but only my app is that slow. – BiAiB Commented Jan 13, 2012 at 14:48
- and what was the output of the profiler. which functions where invoked? – roberkules Commented Jan 24, 2012 at 1:42
1 Answer
Reset to default 16Finally, i've found my answer in a ment of an answer of a related question: Why is this piece of Javascript code so slow?
Ugh, just found someone on a blog with the same problem. Apparently it's only this slow if you're running the IE Developer Toolbar. Now how the heck am I going to profile? -_-'
– Aistina May 7 '09 at 9:22
Why didn't I though about it earlier ?