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 strongm 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.
 
BillyRayPreachersSon

This application that I wrote has many many lines, that being the case it also creates 12-15 objects that have 15-18 member functions each. Where my problem is that the code is auto generated from a db and all the javascript is all after the head including the code for creating the objects and member functions. I possibly can move this .js file but with some difficulty. Since this is a prepriotary app I can not give you a link to the liver full version I can how ever send you to the obfuscated demo version. I am not sure if that will help. If so I can post a link. Thanks for the reply.
 
Dan

The application in question runs starts really slowly in safri 3.0 beta and does not even run in any earlier version of safari except in 1.1, why not sure. How can I make this application run faster based upon the location of js files or something to the like. I have tried many things. Since I get no errors from safari I can not debug something that has no bugs. Thank you for the reply. I hope you understand that the app took a little over a year to produce and is a huge venture for this company and therefore I can not give you any code not even a small ammount.
 
therefore I can not give you any code not even a small ammount.

Sadly we can't really tell you what to change then, not even a small amount.


I've used the analogy multiple times, but it almost always fits - if you went to a repairman and told him that your car is broken but the only symptom you can give him is that it runs slow and you can't bring in the car, or even tell him what type of car it is, do you really think he's going to be able to help you?

-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
 
I suggest investigating JavaScript optimisation techniques (you can use Google to find many of these, or read this post which you could have found by searching this forum):

thread216-1382931

I can't give you a more tailored answer for obvious reasons.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Further to Dan's suggestion... I did some research into loop speeds and posted the test harness code and the results:
thread216-1392878

You could look at how I did the timings and adapt it to your own environment... or use the Java Aspect Wrapping patterns to observe sections of your code.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Dan

Thanks for the reply. I am looking into the situation more. I do not have the time at this moment to research ways of checking for problems in the code that may lead to memory leaks. I would appreciate an article or two if you have any handy. I moved the file that contains all the functions to the head. It turned out to be not such a big deal, but safari is still slow as all get out when it starts the app. Thanks again for the reply.
 
I would appreciate an article or two if you have any handy.

Ooh ooh I know, I know... Me sir, me sir!... How about looking at the links Jeff and I gave you?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I did look at those links, one by the way is not working well was not working the other day .
Reading about the for loops was interesting. I found some things to be self evident to not code in that manner. The rest of the article especially the one on the earthlink page is great for people who do not really have good programming practices. I will have to go through the code all 7k or more to find a possible problem. The funny thing is that the very same member function that are first associated to the objects are used once the app loads completely. The app runs really fast once loaded. This is where I am going out of my mind literally because there is no error message from safari to fix what it might be having a problem with.

Thanks for the replys.
 
if

1. you're stuck,
2. you need Safari support (am curious about why if this is an internal/proprietary app)
3. you don't have the time or expertise to remedy

how about hiring a professional from rentacoder or other jobsite or even approaching Jeff, Dan, khat or j4606 through their sigs.

I'm sure that any pro would sign an NDA in return for a consultancy agreement with some ££ in it.

bear in mind equally that beta software is _beta_... the bigger question you should be asking is why is it not working in safari 2. why not download the developer debugging harness (for mac) and insert some timers and breakpoints to have a look at what is causing the crunch.
 
jpadie

I tried the developer addition of Safari. The funny thing with that is that it has the latest version of the JavaScript engine in it same as the safari beta and since I do not get errors of any sorts I have no idea on what can be done to speed this up and if it is an error or something Safari does not like then why does it not send an error. This application works perfectly more than perfectly in all other browsers. So if there were deficiencies in the code it would not work well at all. There may be some parts that I can refactor again but not at this moment. A comment to your hire the other guys, well let me ask you why this is a professional forum. I know next to nothing about safari and ist crazyness. If you think I should hire one of these guys you mentioned then why does this forum exist in the first place. Thanks for the reply any ways. If there are any other constructive helping comments I wsould greatly appreciate them. I look at the article and posts but nothing is of any help so just putting the question out again to people.

 
If you think I should hire one of these guys you mentioned then why does this forum exist in the first place.

A better question to ask is how on earth are we supposed to tell you how to fix your code if we don't even know what it's supposed to do.


An even better question is why is your code so great that you can't post it? It can't be that great if it's giving you as many problems as you say you're having.


You're posing your question as if there is some secret, magical safari command to speed up your code that we could give to you. Since no such command exists, the only suggestions anybody could provide given the extremely limited information you have provided would be links to general code efficiency practices - which Dan and Jeff were gracious enough to provide above. And then you go as far as to criticize one of the links because it "is great for people who do not really have good programming practices". Under most circumstances people will post their questions to a technical forum for 1 of 2 reasons:

1) They have absolutely no clue what they're doing
2) They are well versed in the language but are stuck on a difficult problem.

By posting 0% of the code that is causing you problems we have no way to know which of the 2 categories you fall under.


Let's just assume for a minute that you fall under category #2. That being the case, 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? Assuming you've done that, it shouldn't be too hard to optimize that chunk of code so that it works faster in Safari. But then again, maybe you fall into category #1 at which point we're just beating a dead horse by offering any suggestions.

Good luck [thumbsup2]

-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
 
If you think I should hire one of these guys you mentioned then why does this forum exist in the first place.

as khat points out: we can't solve a specific problem because you've not shared your specific issue (your code and an explanation of _what_ runs slowly).

given these circs you've exhausted the help that a forum can give you.

the next step, if you satisfy the criteria that i've posted above, is to pay a professional to help you. Under a consultancy contract you would normally have the benefit of an NDA to protect your codebase, which should satisfy the concerns that prevent you from posting the code on this site.
 
I thank every one for their input and there thoughts. The problem I am having is that I have no clue in how to begin to debug something that can not be debugged. I hate to make it seem like I am beating a dead horse but here goes. The app I programmed has a demo highly obfuscated but none the less is there for use. the url is www. ivwebsites .com click the "free demo" button and log in. If you use safari beta 3 it will take approximately 3-4 minutes to load completely. Then it runs perfectly no errors or even any slowness. In the complete editor it evens saves faster than the other browsers. So I am at a stand still. I would love some suggestions on how to find out while the app is loading into the dom certain little nagging points safari may have. Yes I could hire one of you guys or maybe even some one else. This is not the point. I do not want to banter about things any more If you visit the demo and tell me to get a job I will find some one to help. Thanks for looking at the demo much appreciated.
 
Thanks for the URL - now we can help.

Without even looking at the code, I see you have 2 missing (404) css files. This requires the browser waits for a timeout and could very well be a contributing factor.

[ul][li]/stylesheets/default.css[/li]
[li]/stylesheets/template.css[/li][/ul]

Q: What happens when you either remove the reference to them, or place them in the right place? Do you notice any performance change?

Q: Do you notice any performance difference when using the obfuscated versus the unobfuscated version of the dhtml2_Obfs.js javascript file?

Another avenue to explore is the tight loop you are using at initial load time. You could effectively add in some "sleep" commands through use of setTimeout() -- even using a small number like 10ms in that function would be enough to give some control back to the CPU (which may need to do stuff whilst you are looping).

As we've suggested, how about using some timing around some of your functions? Specifically the load code and de-obfuscation code?

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Further to Jeff's post, here are some more things that jump out immediately as being potential hot-spots:

- Your "obfuscated" JS (which doesn't look that obfuscated IMHO) seems to be around 160Kb on one line (i.e. with no line breaks). I know from personal experience that this can cause slow parsing issues in some browsers. So, try putting line breaks in between each function and see if that helps.

- While you have them after most, you do not have ";" delimiters after all your function code. I have been bitten by this before, specifically in Safari, specifically on a JS-intensive app. So, make sure you put semicolons after all of your function close braces.

Some points to note:

- Before trying these, make sure you clear your cache. If you don't, you will not be able to guarantee that any fixes will have been picked up by the browser.

- Why bother with "obfuscation" anyway? As I mentioned earlier, your apparently "obfuscated" code doesn't look very obfuscated. It look like you've simply removed line breaks. This begs the question, why have you obfuscated the code? Given that no matter how well you think you can hide your code, you will [!]never[/!] be able to (trust me on this), give up while you're ahead. See:

faq215-3101
faq216-5090
faq216-355

- Why not set up Rhino or JWebUnit, etc to do some validation of your JS code as part of your automated build process (you do have one of these, right?)

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top