Netscape 7.02 - script problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonny

    Netscape 7.02 - script problem.

    Netscape 7.02 is giving me a headache with a downloaded snow script.
    Starting with a blank page, I inserted the script and checked it in IE
    6 and Netscape 7.02. Everything worked and looked fine. A check on CPU
    usage (Windows Task Manager>Perform ance) gave a 0% to 2% reading for
    both browsers on a Pentium 4, 3.06GHz running XP.

    As I added text, images, tiled background and so on. I noticed the
    mouse was becoming jerky in Netscape 7. Another CPU usage check now
    gave a 98% peak reading for N7 but still 2% in IE??

    I removed the tiled background jpg, which brought it down to 33%. Then
    removed the text and images, now a blank page again except for the
    script, which returned it to 0% to 2%!

    Is there a problem with this script or is it down to Netscape 7? I've
    used loads of animation scripts before in trusty old Netscape 4 and
    never had any problems like this - I've not long upgraded to 7.

    Anyway, the script I'm using is from

    Is it duff and if so where can I find another? The page is for my
    9-year-old daughter, she really wants a snow theme and Daddies looking
    a bit dim at the moment.

    Thanks for any help,
    Jonny.
  • neerolyte

    #2
    Re: Netscape 7.02 - script problem.

    although this is a rather poorly programmed script, Netscape is to blame.

    I have only looked at it in MSIE 6 and Mozilla Firebird 0.7, and experianced
    similar issues, it seems that MSIE has a much cleaner way of drawing the
    webpages, which means that when something is being drawn over and over it
    slows the computer down much more.

    Here is the easiest solution I can come up with:
    change this line:
    runspeed=40; //setTimeout speed!

    to something like this:
    runspeed=naviga tor.appName == "Microsoft Internet Explorer"?40:50 0;
    //setTimeout speed!



    This is not a great solution as it makes the snow jumpy on non MSIE
    browsers, but it will save your CPU and stop the mouse jumping

    "Jonny" <jonny_xyz_75@y ahoo.co.uk> wrote in message
    news:f42fc7f9.0 401051917.22ee6 2c8@posting.goo gle.com...[color=blue]
    > Netscape 7.02 is giving me a headache with a downloaded snow script.
    > Starting with a blank page, I inserted the script and checked it in IE
    > 6 and Netscape 7.02. Everything worked and looked fine. A check on CPU
    > usage (Windows Task Manager>Perform ance) gave a 0% to 2% reading for
    > both browsers on a Pentium 4, 3.06GHz running XP.
    >
    > As I added text, images, tiled background and so on. I noticed the
    > mouse was becoming jerky in Netscape 7. Another CPU usage check now
    > gave a 98% peak reading for N7 but still 2% in IE??
    >
    > I removed the tiled background jpg, which brought it down to 33%. Then
    > removed the text and images, now a blank page again except for the
    > script, which returned it to 0% to 2%!
    >
    > Is there a problem with this script or is it down to Netscape 7? I've
    > used loads of animation scripts before in trusty old Netscape 4 and
    > never had any problems like this - I've not long upgraded to 7.
    >
    > Anyway, the script I'm using is from
    > http://www.btinternet.com/~kurt.grig...t/SnowImg.html
    > Is it duff and if so where can I find another? The page is for my
    > 9-year-old daughter, she really wants a snow theme and Daddies looking
    > a bit dim at the moment.
    >
    > Thanks for any help,
    > Jonny.[/color]


    Comment

    • Mike

      #3
      Re: Netscape 7.02 - script problem.

      "neerolyte" <neerolyte@nets pace.nOsPaM.net .au> wrote in message news:<btdfq9$n4 c$1@otis.netspa ce.net.au>...[color=blue]
      > although this is a rather poorly programmed script, Netscape is to blame.
      >
      > I have only looked at it in MSIE 6 and Mozilla Firebird 0.7, and experianced
      > similar issues, it seems that MSIE has a much cleaner way of drawing the
      > webpages, which means that when something is being drawn over and over it
      > slows the computer down much more.
      >
      > Here is the easiest solution I can come up with:
      > change this line:
      > runspeed=40; //setTimeout speed!
      >
      > to something like this:
      > runspeed=naviga tor.appName == "Microsoft Internet Explorer"?40:50 0;
      > //setTimeout speed!
      >
      >
      >
      > This is not a great solution as it makes the snow jumpy on non MSIE
      > browsers, but it will save your CPU and stop the mouse jumping
      >[/color]

      For any animated script, the timeout/interval has to be at least 50ms.
      Any lower and it just is NOT animated. Netscape 4 handled this sort of
      script with ease as IE continues to.

      Whether the new Netscape's & Opera's are or nor "technicall y correct"
      in their redrawing is beside the point. They are alienating lots of
      people who like this sort of script and helping IE towards total
      domination.

      As for the script in question, It has an option to hide itself from
      Netscape 7; I'd just use that and forget about it. You can try
      http://www.dynamicdrive.com for something else.

      Comment

      • DU

        #4
        Re: Netscape 7.02 - script problem.

        neerolyte wrote:
        [color=blue]
        > although this is a rather poorly programmed script, Netscape is to blame.
        >[/color]

        In part, this is true. Mozilla-based browsers are struggling with very
        demanding animation DHMTL scripts. This is exactly the case here:

        Bug 64516: 95-99% CPU usage for dhtml "snow effect"


        Bug 186442: "snowfall" script causes browser to slow to a crawl

        [color=blue]
        > I have only looked at it in MSIE 6 and Mozilla Firebird 0.7, and experianced
        > similar issues, it seems that MSIE has a much cleaner way of drawing the
        > webpages, which means that when something is being drawn over and over it
        > slows the computer down much more.
        >[/color]

        Yep!
        [color=blue]
        > Here is the easiest solution I can come up with:
        > change this line:
        > runspeed=40; //setTimeout speed!
        >
        > to something like this:
        > runspeed=naviga tor.appName == "Microsoft Internet Explorer"?40:50 0;[/color]

        This is not the best way to detect browsers. Anyway, I think the main
        issue is the setTimeout value. I still don't recommend anything under
        64msec or even 128msec for such page. The original poster has a 3Ghz
        cpu: that,s not the case for many users.
        [color=blue]
        > //setTimeout speed!
        >[/color]

        Correct again! There are a lot of badly coded scripts out there in
        Cut-N-Paste javascript sites which mindlessly have scripts resorting to
        insane setTimeout values demanding insane cpu, video and memory resources.
        [color=blue]
        >
        >
        > This is not a great solution as it makes the snow jumpy on non MSIE
        > browsers, but it will save your CPU and stop the mouse jumping
        >[/color]

        It is a better solution than you may think. setTimeout values (in
        particular in recursive calls and intense DHTML animations) should never
        be faster than 64 msec. for demanding scripts. Even MSDN says so too.

        "Code optimization:
        setTimeout
        Speaking of animation, one of the most common techniques for animating
        elements is to use a timer with window.setTimeo ut to position an element
        on the page incrementally. A quick tip: Use as few timers as possible.
        Timers consume valuable system resources, and the behavior of multiple
        timers, all working together, will greatly vary on differently powered
        machines. A way to animate multiple elements, while minimizing timer
        use, is to employ a single main loop, powered with a single
        window.setTimeo ut() call. In that single loop, keep a list of all
        elements you need to manipulate. Loop through that list with each tick,
        and perform your required move."
        Michael Wallent
        Microsoft Corporation


        DU

        [color=blue]
        > "Jonny" <jonny_xyz_75@y ahoo.co.uk> wrote in message
        > news:f42fc7f9.0 401051917.22ee6 2c8@posting.goo gle.com...
        >[color=green]
        >>Netscape 7.02 is giving me a headache with a downloaded snow script.
        >>Starting with a blank page, I inserted the script and checked it in IE
        >>6 and Netscape 7.02. Everything worked and looked fine. A check on CPU
        >>usage (Windows Task Manager>Perform ance) gave a 0% to 2% reading for
        >>both browsers on a Pentium 4, 3.06GHz running XP.
        >>
        >>As I added text, images, tiled background and so on. I noticed the
        >>mouse was becoming jerky in Netscape 7. Another CPU usage check now
        >>gave a 98% peak reading for N7 but still 2% in IE??
        >>
        >>I removed the tiled background jpg, which brought it down to 33%. Then
        >>removed the text and images, now a blank page again except for the
        >>script, which returned it to 0% to 2%!
        >>
        >>Is there a problem with this script or is it down to Netscape 7? I've
        >>used loads of animation scripts before in trusty old Netscape 4 and
        >>never had any problems like this - I've not long upgraded to 7.
        >>
        >>Anyway, the script I'm using is from
        >>http://www.btinternet.com/~kurt.grig...t/SnowImg.html
        >>Is it duff and if so where can I find another? The page is for my
        >>9-year-old daughter, she really wants a snow theme and Daddies looking
        >>a bit dim at the moment.
        >>
        >>Thanks for any help,
        >>Jonny.[/color]
        >
        >
        >[/color]

        Comment

        • Lee

          #5
          Re: Netscape 7.02 - script problem.

          Mike said:
          [color=blue]
          >Whether the new Netscape's & Opera's are or nor "technicall y correct"
          >in their redrawing is beside the point. They are alienating lots of
          >people who like this sort of script and helping IE towards total
          >domination.
          >
          >As for the script in question, It has an option to hide itself from
          >Netscape 7; I'd just use that and forget about it. You can try
          >http://www.dynamicdrive.com for something else.[/color]

          Apparently, no version of Netscape beyond 4 was available to the
          author when he wrote the code. It treats it as an "other" browser,
          and not very efficiently. Blaming the browser for having trouble
          with bad code is one reason why IE is the predominant browser among
          people who don't know any better.

          Comment

          • Mike

            #6
            Re: Netscape 7.02 - script problem.

            Lee <REM0VElbspamtr ap@cox.net> wrote in message news:<btevgj02b d7@drn.newsguy. com>...
            [color=blue]
            > Apparently, no version of Netscape beyond 4 was available to the
            > author when he wrote the code. It treats it as an "other" browser,
            > and not very efficiently. Blaming the browser for having trouble
            > with bad code is one reason why IE is the predominant browser among
            > people who don't know any better.[/color]

            The coding for the script isn't bad at all. The main repeating
            function is very basic:

            Increase y-pos at a random speed, give x-pos a bit of a wiggle.
            When y-pos reaches the bottom of the page, reset y-pos, x-pos and
            speed.
            Assign y-pos, x-pos and speed to the objects[snow flakes] and repeat.
            Simple.

            Making it even more basic by removing the x-pos wiggle and the
            scrolling doesn't affect the high cpu strain in N7, it's just as high.
            The OP's tiled background problem is also true and a new one to me,
            very odd and not acceptable.

            I'm not for or anti any browser but N7 is not cutting the mustard with
            dhtml.

            Comment

            • DU

              #7
              Re: Netscape 7.02 - script problem.

              Mike wrote:
              [color=blue]
              > Lee <REM0VElbspamtr ap@cox.net> wrote in message news:<btevgj02b d7@drn.newsguy. com>...
              >
              >[color=green]
              >>Apparently, no version of Netscape beyond 4 was available to the
              >>author when he wrote the code. It treats it as an "other" browser,
              >>and not very efficiently. Blaming the browser for having trouble
              >>with bad code is one reason why IE is the predominant browser among
              >>people who don't know any better.[/color]
              >
              >
              > The coding for the script isn't bad at all. The main repeating
              > function is very basic:
              >
              > Increase y-pos at a random speed, give x-pos a bit of a wiggle.
              > When y-pos reaches the bottom of the page, reset y-pos, x-pos and
              > speed.
              > Assign y-pos, x-pos and speed to the objects[snow flakes] and repeat.
              > Simple.
              >[/color]

              The algorithm as described is simple; the implementation in conformance
              to W3C web standards is another issue and you want to support MSIE 6 for
              windows when triggered in stdandards compliant rendering mode. The page
              is far, very very far from such goal.
              [color=blue]
              > Making it even more basic by removing the x-pos wiggle and the
              > scrolling doesn't affect the high cpu strain in N7, it's just as high.
              > The OP's tiled background problem is also true and a new one to me,
              > very odd and not acceptable.
              >
              > I'm not for or anti any browser but N7 is not cutting the mustard with
              > dhtml.[/color]


              You first have to establish that the code is well written, robust,
              compliant with widely established and acknowleged W3C web standards like
              HTML 4.01, W3C DOM 2 events attributes and methods, W3C DOM Core
              attributes and methods. Here, that page markup code does not even
              validate, the browser detection is old, outdated and will often fail, it
              resorts to document.write( ) calls in IE for no good reasons, it does not
              use any DOM 2 events method, even the measurements of the viewport is
              wrong for MSIE unless backward compatible rendering mode is used, etc..
              For many reasons, professional web designers would judge that code as
              not good at all.

              Once and only once you have in front of you a well written code you can
              assess (and compare with other browsers) the NS 7.x DHTML performance on
              one single highly-resource-demanding animation script.

              DU

              Comment

              • Jonny

                #8
                Re: Netscape 7.02 - script problem.

                Thanks all but I'm still having no luck with Netscape 7. I tried the
                Snow Effect at

                A slightly higher CPU reading than the first script and a full 100%
                reading for Netscape 7 with a tiled background - I just don't get what
                the background deal is about!

                I also tried Snowmaker at

                The CPU reading was 30% for N7 (10 flakes) with a background, 0%
                without. This one doesn't use images and isn't as pretty as the other
                two.

                Oh well, I'll stick with the first script and use its N7 hide feature.
                It looks the best and I also like its timed clear out part.

                Thanks again,
                Jonny.

                Comment

                • DU

                  #9
                  Re: Netscape 7.02 - script problem.

                  Jonny wrote:[color=blue]
                  > Thanks all but I'm still having no luck with Netscape 7. I tried the
                  > Snow Effect at
                  > http://www.dynamicdrive.com/dynamicindex3/snow.htm
                  > A slightly higher CPU reading than the first script and a full 100%
                  > reading for Netscape 7 with a tiled background - I just don't get what
                  > the background deal is about!
                  >
                  > I also tried Snowmaker at
                  > http://www.24fun.com/downloadcenter/snow/snow.html
                  > The CPU reading was 30% for N7 (10 flakes) with a background, 0%
                  > without. This one doesn't use images and isn't as pretty as the other
                  > two.
                  >
                  > Oh well, I'll stick with the first script and use its N7 hide feature.
                  > It looks the best and I also like its timed clear out part.
                  >
                  > Thanks again,
                  > Jonny.[/color]


                  You have not really understood all I wrote in my previous post. Here are
                  recommendations for you.

                  1- Make sure the page which will host this snow flakes falling randomly
                  uses valid, validated markup code. That means a correct and valid
                  doctype declaration, preferably a strict definition like HTML 4.01
                  strict along with a character encoding declaration:

                  W3C Quality Assurance tip
                  Don't forget to add a doctype:


                  List of valid DTDs you can use in your document.


                  W3C validator:
                  W3C's easy-to-use markup validation service, based on SGML and XML parsers.


                  The Importance of Code Validation


                  Why we won’t help you:


                  Activating the Right Layout Mode Using the Doctype Declaration
                  Aalto University, Finland is a new multidisciplinary science and art community in the fields of science, business, and art and design.


                  2- Make sure you understand the javascript code and that you know for a
                  fact that it is optimized and that it will overwhelm users with modest
                  cpu/RAM/video resources. That means to limit the number of snow flakes
                  and recursive calls at set intervals. In other words, don't go with a
                  setTimeout(expr , 40)
                  but rather give preference to
                  setTimeout(expr , 128)
                  There are number of code optimization techniques available to make your
                  webpage code size, download time, parsing and rendering in browsers
                  small, fast, optimal. Same thing with optimization the CSS code and the
                  javascript code.

                  3- The %tage of cpu activity is just a sign, a symptom if you wish, of
                  the burden imposed onto the user's system resources by the script
                  functions. It is true that NS 7.1 and Mozilla-based browsers (compared
                  to MSIE 6 for windows for instance) is more sensitive to issues and
                  matters related to DHTML performance in animation scripts (and there is
                  a meta-bugfile at bugzilla on DHTML performance improvements) but IMO
                  this should not be a decisive factor. Good and optimized script
                  functions will be able to run on modest systems.
                  You gave %tage of cpu activity and you're using a 3Ghz cpu: consider the
                  ordinary visitor with a 500Mhz cpu to 1Ghz cpu.

                  In every single page, url you mentioned, none of them actually were
                  meeting the requirements I gave here.

                  Finally, consider that snow flakes effect are only cosmetic ornemental
                  graphical effects adding/bringing no content per se to a page but
                  demanding considerably quite a lot from the visitor's system; after a
                  while (a min or so), users get tired of it (it was established that
                  constantly running, moving graphics disturb and diminish peripherical
                  vision and concentration to read) and wish they could turn it off...only
                  to realize that they can't!

                  DU

                  Comment

                  • Mike

                    #10
                    Re: Netscape 7.02 - script problem.

                    DU <drunclear@hotR EMOVETHISmail.c om> wrote in message news:<btfip3$dt 8$1@news.eusc.i nter.net>...
                    [color=blue]
                    > You first have to establish that the code is well written, robust,
                    > compliant with widely established and acknowleged W3C web standards like
                    > HTML 4.01, W3C DOM 2 events attributes and methods, W3C DOM Core
                    > attributes and methods. Here, that page markup code does not even
                    > validate, the browser detection is old, outdated and will often fail, it
                    > resorts to document.write( ) calls in IE for no good reasons, it does not
                    > use any DOM 2 events method, even the measurements of the viewport is
                    > wrong for MSIE unless backward compatible rendering mode is used, etc..
                    > For many reasons, professional web designers would judge that code as
                    > not good at all.
                    >
                    > Once and only once you have in front of you a well written code you can
                    > assess (and compare with other browsers) the NS 7.x DHTML performance on
                    > one single highly-resource-demanding animation script.
                    >
                    > DU[/color]

                    Your points about correct/strict page markup are of course valid but
                    are not the answer here.

                    In Netscape 7:

                    Why does CPU usage 'dramatically' increase when it is asked to animate
                    multiple divisions containing "images"?

                    Why does CPU usage 'dramatically' increase when it is asked to animate
                    multiple divisions of "any sort" over a tiled background image?

                    The script in question may indeed be pointless but I'm very interested
                    DHTML games. These N7 "oddities" are a big deal.

                    Below is a simple animation script as basic as you can get. It's
                    strict compliant and for this test, IE vs N7, is perfectly adequete.
                    Run it in IE and Netscape 7 as is and note their respective CPU usage.

                    Now add a variety of tiled backgrounds to the body tag and again check
                    CPU usage.

                    Then place any image inside the "obj" div, alter div height/width
                    accordingly, and check again. I look forward to reading your results.


                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                    "http://www.w3.org/TR/html4/strict.dtd">
                    <html>
                    <head>
                    <style>
                    ..division{
                    position:absolu te;top:0px;left :0px;
                    height:12px;wid th:12px;backgro und:#ff0000;
                    }
                    </style>
                    </head>
                    <body>

                    <script>
                    t=new Array();y=new Array();x=new Array();
                    for (i=0; i < 30; i++){
                    document.write( "<div id='obj"+i+"' class='division '></div>");
                    y[i]=i*13;
                    x[i]=parseInt(Math. random()*400);
                    t[i]=document.getEl ementById("obj" +i).style;
                    t[i].top=y[i]+"px";
                    }

                    function ini(){
                    for (i=0; i < 30; i++){
                    x[i]++;
                    if (x[i] >= 400) x[i]=0;
                    t[i].left=x[i]+"px";
                    }
                    setTimeout("ini ()",50);
                    }
                    window.onload=i ni;
                    //-->
                    </script>

                    </body>
                    </html>

                    Comment

                    • Randy Webb

                      #11
                      Re: Netscape 7.02 - script problem.

                      Mike wrote:
                      <--snip-->
                      [color=blue]
                      > In Netscape 7:
                      >[/color]

                      Which N7? 7.02? Its old.
                      [color=blue]
                      > Why does CPU usage 'dramatically' increase when it is asked to animate
                      > multiple divisions containing "images"?
                      >
                      > Why does CPU usage 'dramatically' increase when it is asked to animate
                      > multiple divisions of "any sort" over a tiled background image?
                      >
                      > The script in question may indeed be pointless but I'm very interested
                      > DHTML games. These N7 "oddities" are a big deal.
                      >
                      > Below is a simple animation script as basic as you can get. It's
                      > strict compliant and for this test, IE vs N7, is perfectly adequete.
                      > Run it in IE and Netscape 7 as is and note their respective CPU usage.
                      >
                      > Now add a variety of tiled backgrounds to the body tag and again check
                      > CPU usage.
                      >
                      > Then place any image inside the "obj" div, alter div height/width
                      > accordingly, and check again. I look forward to reading your results.[/color]

                      Nothing I added to it in Netscape 7.1 slowed it down. It may very well
                      be something that got 'fixed' in the later revisions/versions of NS7.


                      --
                      Randy

                      Comment

                      • Mike

                        #12
                        Re: Netscape 7.02 - script problem.

                        Randy Webb <hikksnotathome @aol.com> wrote in message news:<yfqdnW5cc 6nFpp_dRVn-tw@comcast.com> ...[color=blue]
                        > Mike wrote:
                        > <--snip-->
                        >[color=green]
                        > > In Netscape 7:
                        > >[/color]
                        >
                        > Which N7? 7.02? Its old.
                        >[color=green]
                        > > Why does CPU usage 'dramatically' increase when it is asked to animate
                        > > multiple divisions containing "images"?
                        > >
                        > > Why does CPU usage 'dramatically' increase when it is asked to animate
                        > > multiple divisions of "any sort" over a tiled background image?
                        > >
                        > > The script in question may indeed be pointless but I'm very interested
                        > > DHTML games. These N7 "oddities" are a big deal.
                        > >
                        > > Below is a simple animation script as basic as you can get. It's
                        > > strict compliant and for this test, IE vs N7, is perfectly adequete.
                        > > Run it in IE and Netscape 7 as is and note their respective CPU usage.
                        > >
                        > > Now add a variety of tiled backgrounds to the body tag and again check
                        > > CPU usage.
                        > >
                        > > Then place any image inside the "obj" div, alter div height/width
                        > > accordingly, and check again. I look forward to reading your results.[/color]
                        >
                        > Nothing I added to it in Netscape 7.1 slowed it down. It may very well
                        > be something that got 'fixed' in the later revisions/versions of NS7.[/color]

                        Yeah, I'm on 7.02. Very interesting, cheers Randy. I'll see if 7.1 is
                        on the .net magazine disc.

                        Comment

                        Working...