eval

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

    #31
    Re: eval

    In article <he1hd7vj.fsf@h otpop.com>, Lasse Reichstein Nielsen <lrn@hotpop.com >
    writes:
    [color=blue]
    >hikksnotathome @aol.com (HikksNotAtHome ) writes:
    >[color=green]
    >> The first one, John Stocktons site has a textarea for input of
    >> script to test it. When testing it, it seems to be the best way to
    >> do it (using eval).
    >>
    >> The other one was a problem I had a while back (it was discussed
    >> here) where I had a select list that had fractions as its value.[/color]
    >
    >I remember that :)
    >[color=green]
    >> The fractions were random in the sense that they weren't always the
    >> same denominator. The problem was trying to convert the fraction to
    >> a decimal. It turned out that, in some browsers, eval performed at
    >> the same level as splitting on the / and then dividing.[/color]
    >
    >If it was only at the same level, then I wouldn't use eval. You need
    >total control of the arguments to eval (or a syntax check), which should
    >outweigh the advantage you get from shorter code.[/color]

    The tests that Richard and I did, eval actually outperformed split in IE6. In
    the end, I used the split approach for two reasons. First was to try to teach
    some inexperienced people another way to do it. Second was so that I wouldn't
    have to listen to the same people rail me about "You do what you tell us not to
    do".

    The control of the arguments wasn't a problem. Whether using eval or the split
    method, it would still need to be tested (which in my app it is) to ensure that
    nothing got screwy and sent me bad data in the select lists so I don't see that
    as a performance hit since I have to do it no matter what approach I use.
    [color=blue]
    >As for speed. As far as I can see, eval is *much* slower (more tha 5x)
    >than using split in IE 6. A little faster yet is finding the "/" with
    >indexOf and using substring to get the parts:
    > var i = str.indexOf("/");
    > return str.substr(0,i)/str.substr(i+1) ;
    >
    >In Opera 7.2, split was fastest and eval slowest. In MozFB, split and
    >eval are comparable. In Netscape 4.8, eval is actually twice as fast
    >as split, and 1.5 times as fast as using substring. It is generally
    >slower than the other browsers, though.[/color]

    The thread at http://tinyurl.com/tw7d shows some of the tests, and discussions,
    about the speed impacts.
    [color=blue][color=green]
    >> Where's the one place you use it?[/color]
    >
    >A text area for input of scripts (actually the one that I link to in
    >this signature).[/color]

    That is the use of it that I was referring to with John's site. Didn't know
    yours had it as well (I very seldom follow signature URLs).
    --
    Randy

    Comment

    • Thomas 'PointedEars' Lahn

      #32
      Re: [OT] Cancel

      HikksNotAtHome wrote:
      [color=blue]
      > [...] Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:[color=green]
      >>Not necessary. I've downloaded messages from another news server with
      >>another newsreader and there was only one posting from me in this thread.
      >>The Cancel worked and Mozilla is not buggy on that. If you see dupes either
      >>your news server did not (yet) obey it or your newsreader does not provide
      >>appropriate feedback.[/color]
      >
      > Go to groups.google.c om and look at the archive. http://tinyurl.com/tw51 and it
      > does indeed show the duplicate posts. Message 38 and 39 in the eval thread.
      >
      > One should practice what they preach.[/color]

      It is widely known that Google Groups does not obey Cancel messages
      (but I will remove it manually there, now that it has been archived),
      and it seems the same goes for http://tinyurl.com/tw51 and other web
      archives. You may try other *news* *servers*, like news.cis.dfn.de or
      news.tu-ilmenau.de (I tested the latter) to see this confirmed.


      HTH

      PointedEars

      P.S.
      I would not have answered your posting if I had Internet connection
      at home by now.

      Comment

      • HikksNotAtHome

        #33
        Re: [OT] Cancel

        In article <bodn4l$1cnjf7$ 1@ID-107532.news.uni-berlin.de>, Thomas 'PointedEars'
        Lahn <PointedEars@we b.de> writes:
        [color=blue][color=green]
        >> Go to groups.google.c om and look at the archive. http://tinyurl.com/tw51[/color]
        >and it[color=green]
        >> does indeed show the duplicate posts. Message 38 and 39 in the eval thread.
        >>
        >> One should practice what they preach.[/color]
        >
        >It is widely known that Google Groups does not obey Cancel messages
        >(but I will remove it manually there, now that it has been archived),
        >and it seems the same goes for http://tinyurl.com/tw51 and other web
        >archives. You may try other *news* *servers*, like news.cis.dfn.de or
        >news.tu-ilmenau.de (I tested the latter) to see this confirmed.[/color]

        It only takes one example of a service that doesn't obey the Cancel message to
        show the fallacy of relying on it. The fact that so many people (including
        myself) read the duplicate should indicate to you that it didn't work[1].
        [color=blue]
        >P.S.
        >I would not have answered your posting if I had Internet connection
        >at home by now.[/color]

        What does "at home" and "not at home" have to do with answering a post?

        [1] "work" in the sense that the message didn't get cancelled.
        --
        Randy

        Comment

        • Dr John Stockton

          #34
          Re: eval

          JRS: In article <20031106092151 .06226.00001366 @mb-m19.aol.com>, seen in
          news:comp.lang. javascript, HikksNotAtHome <hikksnotathome @aol.com>
          posted at Thu, 6 Nov 2003 14:21:51 :-
          [color=blue][color=green]
          >>A text area for input of scripts (actually the one that I link to in
          >>this signature).[/color]
          >
          >That is the use of it that I was referring to with John's site. Didn't know
          >yours had it as well (I very seldom follow signature URLs).[/color]

          Elsewhere on the site one can find instances of a somewhat different
          usage.

          Sometimes, where an input number is required, a user may wish to supply
          an expression; for example, if a distance in kilometres is required, it
          may be convenient to supply "<miles>*1. 609. I would only do this on a
          technical page, such as astro.htm; it would not be appropriate for
          others.

          --
          © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
          Web <URL:http://www.merlyn.demo n.co.uk/> - FAQqish topics, acronyms & links;
          some Astro stuff via astro.htm, gravity0.htm; quotes.htm; pascal.htm; &c, &c.
          No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

          Comment

          Working...