I am Bored Posted February 23, 2015 Report Posted February 23, 2015 After noticing that Firefox was using 25% CPU almost constantly with MD open (Opera uses 0-3%), I did a bit of digging. I noticed that updatetime was taking most of the time. Naturally, I went to look at the function. It has nothing that should be nearly that expensive. I then noticed by complete chance that there were no semicolons at the end of the line. Wondering if this could, for some absurd reason, be the cause, I promptly re-defined the functions to be semi-colon terminated. No sooner had I done that than the CPU usage (and absurd amount of memory allocation thrashing) disappeared. The morale of the story? Always terminate your statements in Javascript with semicolons, because, although it will still work in most browsers, you never know how a browser will handle it. The pair of functions, with semicolons added: function padlength(what){ var output=(what.toString().length==1)? "0"+what : what; return output; } function displaytime(){ serverdate.setSeconds(serverdate.getSeconds()+1); var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate()); //+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()); document.getElementById("servertime").innerHTML=datestring+" "+timestring;//datestring+" "+ } Jubaris, No one, dst and 3 others 5 1 Quote
Root Admin Chewett Posted February 23, 2015 Root Admin Report Posted February 23, 2015 Im unconvinced that this is the issue. Semi colons at the end of a line is not required in javascript as it will tokenize the newline.I think your combined efforts of hacking around MD has finally got to your browser. I have told you bored that if you are modifying MD I dont want your reports because then you are running some custom thing that I cannot debug.I will eventually get around to cleaning that up but I think there is no evidence to say it has any effect on CPU time. dst 1 Quote
I am Bored Posted February 23, 2015 Author Report Posted February 23, 2015 After some more testing, the fix applied seams to have no effect at all, yet it worked as-described this morning. It looks like I'll have to do some more digging to figure this issue out. The CPU usage difference is present though. Quote
No one Posted February 23, 2015 Report Posted February 23, 2015 I think your combined efforts of hacking around MD has finally got to your browser. I have told you bored that if you are modifying MD I dont want your reports because then you are running some custom thing that I cannot debug. This is just mean and you know it. We all know that MD is filled with bugs. Lets see how IaB explains / prove it. I too have some issues with MD. When it is running too long I have to refresh the page to make it run smoother. But I've always attributed this to the flash usage. Chewett and DARK DEMON 2 Quote
Root Admin Chewett Posted February 23, 2015 Root Admin Report Posted February 23, 2015 This is just mean and you know it. We all know that MD is filled with bugs. Lets see how IaB explains / prove it. I too have some issues with MD. When it is running too long I have to refresh the page to make it run smoother.But I've always attributed this to the flash usage.We are talking about it on yim, he has been bombarding me with him hacking apart MD.If we can see some stats, I will implement the changes sooner than planned, but I dont see any reason for it to make a difference due to how it works.also: https://www.youtube.com/watch?v=WGoi1MSGu64 Quote
I am Bored Posted March 1, 2015 Author Report Posted March 1, 2015 This can probably be moved into resolved bugs, as the initial claim was invalid, and the actual cause was discovered and posted in: http://magicduel.invisionzone.com/topic/16289-md-is-not-speculative-parsing-friendly/ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.