That's ludicrous...all he's changed is a matter of programmatical style with
negligible effect on performance ;)
--JC

----- Original Message -----
From: "Jeff Greenberg" <[EMAIL PROTECTED]>
To: "Tuomas Huhtanen" <[EMAIL PROTECTED]>; "DynApi-Help"
<[EMAIL PROTECTED]>
Sent: Tuesday, November 13, 2001 5:36 PM
Subject: Re: [Dynapi-Help] Process strings faster with a StringObject!


> I suppose your test results mean, for instance, that StringBuffer is 2.9
times
> faster than HyperString... not 2.9 times faster than built-in methods,
correct?
>
> Jeff Greenberg
> [EMAIL PROTECTED]
>
> Tuomas Huhtanen wrote:
>
> > Good work with the StringObject / HyperString. I couldn't keep my hands
out
> > of this one, though, so I tried to improve the HyperString a bit. As I
am a
> > hardcore java programmer, the final output of my work looks like:
> >
> >   function StringBuffer(){}
> >   StringBuffer.prototype = new Array(0);
> >   StringBuffer.prototype.append = function(str){
> >     this[this.length] = str;
> >   }
> >   StringBuffer.prototype.toString=function(){
> >    return this.join('');
> >   }
> >
> >   I ran the same tests that can be found form
> > http://www24.brinkster.com/dyntools/samples/hyperstring.html
> > with several different browsers and the results are:
> >
> >   IE5.5   StringBuffer 2.9 times faster.
> >   NS4.72  Processing takes about the same.
> >   Opera 5 StringBuffer 1.2 times faster.
> >
> > Other advantage is that the methods of Array are directly usable on
> > StringBuffer. So please, use it if you feel like it.
> >
> > --
> > th
> >
> > > Hello everyone,
> > >
> > > Some time ago I had created a string handling library
> > > for my vb projects, which would speed up string
> > > concatenations. When I started programming in
> > > javascript I've realized that there was a need for
> > > such a library since javascript had the same problem
> > > as VB.
> > >
> > > StringObject is a very simple javascript object that
> > > can in cases where you might need to do string
> > > concatenations:
> > >
> > >       StringObject=function(){}
> > >       StringObject.prototype.db=[];
> > >       StringObject.prototype.add=function(src){
> > >               this.db[this.db.length]=src;
> > >       }
> > >       StringObject.prototype.toString=function(delim){
> > >               return this.db.join(delim||'');
> > >       }
> > >       StringObject.prototype.flush=function(){
> > >               this.db=[];
> > >       }
> > >       StringObject.prototype.indexOf=function(q){
> > >               return this.db.join('').indexOf(q)
> > >       }
> > >
> > >
> > > Here's an example:
> > >
> > >
> > > // #1: Conventional method
> > >       var src='',din=new Date()
> > >       for (var i=0;i<2000;i++){
> > >               d=" svcsvadvnvdv gdg rgr gr gr grgrg <br>"
> > >               src+=d
> > >       }
> > >       file://src=src.indexOf("1999") // simple lookup
> > >       var dout=new Date()
> > >       alert(dout-din)
> > >
> > >
> > >
> > > // #2: With StringObject
> > >       var src='',din=new Date()
> > >       so=new StringObject()
> > >
> > >       for (var i=0;i<2000;i++){
> > >               d=" svcsvadvnvdv gdg rgr gr gr grgrg <br>"
> > >               so.add(d)
> > >       }
> > >       src=so.toString('')
> > >       file://src=so.indexOf("1999") // simple lookup
> > >       var dout=new Date()
> > >       alert(dout-din)
> > >
> > >
> > > The above example (#2) when tested on a pentium 200MHz
> > > was able to process over 70,000 characters in under
> > > 0.03 seconds! Try doing that using the conventional
> > > methods.
> > >
> > > I would like to proposed that such an object be added
> > > to DynAPI core so that users don't have to implement
> > > separate objects for their widgets or extensions. They
> > > could just reference it from the core.
> > >
> > >
> > >
> > > --
> > > Raymond
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Find a job, post your resume.
> > > http://careers.yahoo.com
> > >
> > > _______________________________________________
> > > Dynapi-Help mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/dynapi-help
> >
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/dynapi-help
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help
>

_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to