Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there any safari experts on thig forum 2

Status
Not open for further replies.

thechasboi

IS-IT--Management
Sep 18, 2007
32
I was wondering if there is any safari experts in this forum. I have this application I wrote in javascript. It is about 6k lines rather large for a javascript app but none the less it work perfectly fine in beta 3 on mac and windows. The app runs perfectly in ff on mac and pc, ie5.5+, sea monkey, netscape 6.5+, and camino. Thanks for the reply.
 
Thanks for the replies and for looking at the demo.

First I took out the css file since they are no longer used, same slowness.

The full app has the ; placed at the end of each function.

The obfuscated version runs the same as the unobf, there is perceivable differences but not much.

I have used setTimeout's before on all the object creation and member function as well, this was only 100ms. This made no difference. I was confused about your comments before I apologize for that.

I moved the dhtml2_objf.js file above the header ending tag, no difference.

I validated my code in Aptana IDE before obfuscating so the js file was validated in full by Aptana. I am not understnading what this could be.

Hey any one ever try to insert an alert in a function the you know is only used during loading of the page and app? If so what result. I am going to give that a try later.


Thanks again for the replies
 
I have tried to stagger the timeouts on the member functions and still no difference in the length of time to load.

cLFlaVA you got any ideas?.
 
I havn't look at all your code cause its huge and uncommented/has no spaces. But I noticed on your main page that u have these.
Code:
page=new jh('container');
alert("b4add1");
wa[0]=new jj('wa[0]', 'ulButtons', 0);
alert("b4add2");
wa[0].gt=true;wa[0].zoot();
alert("b4add3");
wa[0].fg(0, 0);
alert("b4add4");
wa[0].lit();
alert("b4add5");
wa[0].gg('');
alert("b4add6");
Looking at those I decided to put alerts between them because they follow the memory leak pattern.
Code:
   var someobj
    function Leak(){
        someobj=document.getElementById(blah);
        document.getElementById(blah).prop=someobject;
    }
I think it might be there. Atleast it seems like It could I treid to look a bit futher but it could be anywhere in your jj object. and since the definition for that obj is somewhere in your 15000+ character one liner, I'm not bothering going further... Hope that helps
 
j4606

I look and looked while loading safari and reloading safari for leaks in the memory in the task manager. I see no increase in memory usage when either the full version or the demo is or both at the same time are loaded. I inserted return true in all the functions that do not return something to try and stem a possible leak of sorts.

I was reading online that if you have an object and reference that object in the same function you may get a leak. Meaning that while the jj object is being created there are member functions that contain properties of that object so it seems that the very nature of this application makes it problematic in Safari. And since Safari does not like to have objects in function reference themselves even through other functions then I am stuck until Safari fixes their problem. This is my thought on this that is.

Thanks for the reply. Thanks for all the replies. I still would appreciate some constructive thoughts on what I may do to eleviate this problem.

 
Weird when I run your demo app my cpu usage goes to about 90% on safari, when it hits those lines I pointed out. After those objects are created cpu usage goes back to normal.
 
I have been reading some article one particularly pretty interesting was something about closures and accidental closures in ecma scripting, which this app obeys. I found that when I create the objects inside the function I called libinit() it seems that I create accidental closures of my objects. I moved the object creation outside that those function calls before the libinit inside the window.onload event caller. This helps the performance on the complete app. I am going to make these changes to the demo and see what happens. I would appreciate if you or any of the other posters can test this as well. Thanks again for the reply. Give me about 15 minutes before testing.
 
Still get lots of CPU usage but I think it is working better did a brief test which isn't to reliable... Run on ie mac cause I'm at work. I used the code I downloaded yesterday vs the code on your site today.

 
I have a fix for this problem I just need to integrate that into the obfuscated code. Going to be a pain but probably tomorrow will be done. I will have questions about the current version of safari and its innerHTML replacement problem. Plus possible two or three others. THanks for the replies.
 
I found this problem by dclaring a var that is the current time then at the end of the function alert the difference between now and that var and wow it took safari 6-7 seconds per object to do this task where the other browsers were less than a .25 seconds per object. Now it really screams with the fix. The other thing I did was add a "return true;" to every function that does not return something. These changes plus the finding out I was closing my objects while inside the libint function has made the app lightning fast. I thank you again for the replies.

I created this function that parses a string then individually inserts the css data into the DOM but apparently Safari has a revolt and pukes when this is done. So I used a different route and shoved the whole string into the DOM at one time. Now the load is instantaneous. I will get that into the demo possibly tonight or tomorrow. Thanks again for the help. I was literally going nuts.
 
I found this problem by dclaring a var that is the current time then at the end of the function alert the difference between now and that var

That's a good suggestion, somebody should have mentioned it earlier *cough* *cough*

myself said:
[small]I'll assume that you have timed your script in Safari using millisecond differences of test date objects inserted into your code to determine what the biggest bottleneck is, right?[/small]

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
khat

Fair enough I do recall you mentioning that before. I asked shortly after you mentioned this if is was possible if it were loading and no one answered. Well I took a plunge and tried. I did how ever think the first time I look into this problem that it was that function but had no idea if I could check. Thanks every one for their help and words of wisdom. I will have the demo reobf tomorrow sometime for looking at this thing finally work really fast actually. I took it from a 6-7 second run time to 30-40 millisecinds. Err small difference. It is even faster in all the other browsers.
 
I do not have this fix for safari up yet in the demo. It is how ever in the full app.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top