Hi, what about the checksum control to test m/text changed or not, if changed then parse and count the words. I did not try but this may reduce the CPU cost.
if not-equal? old-checksum new-checksum [...] > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf > Of Nick Antonaccio > Sent: Monday, October 12, 2009 8:36 AM > To: [email protected] > Subject: [REBOL] Re: Rebol/View 'Key Event Problem >=20 >=20 > Thanks Max :) >=20 > It works quickly, even with large files, but can be a major resource > =3D20 > hog. Using a text file with 112000 words, and a rate of 0, it =3D20 > increased my CPU usage to 50%. Setting the rate to 10 reduced CPU = =3D20 > usage to 33%, rate 5 reduced CPU usage to around 18%, and rate 1 only > =3D20 > used about 8% (I had a number of other windows open, which accounted > =3D20 > for about 3% CPU usage. >=20 > Thorsten, use a slower rate, if it makes sense in your app (does the > =3D20 > update need to happen more often than once, or maybe 2-3 times per = =3D20 > second?). >=20 >=20 > Quoting Maxim Olivier-Adlhoch <[email protected]>: >=20 > > > > Nick, > > > > that is such a nice trick :-) > > > > -MAx > > > > On Wed, Oct 7, 2009 at 11:29 PM, Nick Antonaccio <[email protected]> > wrote: > >> > >> Hi Thorsten, > >> > >> You could just use a timer event on the info style: > >> > >> view layout [ > >> =3D3DA0 =3D3DA0 i: info rate 0 feel [ > >> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 engage: func [f a e] [ > >> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 if a =3D3D3D3D = 'time [ > >> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 l: = length? parse > m/text n=3D > one > >> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 = i/text: join > "Wordcount: =3D > " l > >> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 = show i > >> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 ] > >> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 ] > >> =3D3DA0 =3D3DA0 ] > >> =3D3DA0 =3D3DA0 m: area > >> ] > >> > >> HTH =3D3DA0:) > >> > >> - Nick > >> > >> > >> Quoting Thorsten Moeller <[email protected]>: > >> > >>> > >>> Hi, > >>> > >>> i am just writing a small editor for myself which should have a > realtime > >>> wordcount. Simplified i have following situation: > >>> > >>> editor: layout [ mytext: area ifo: info btn "Close" [unview]] > >>> > >>> view editor > >>> > >>> I am not too familiar with events in rebol. From the docs i learned > that > >>> i have to change the area definition to something like the > following to > >>> make the area react on key events: > >>> > >>> =3D3DA0 =3D3DA0 =3D3DA0mytext: area feel [ > >>> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 engage: func [face action event] [ > >>> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 if action = =3D3D3D3D 'key [mylen: > lengt=3D > h? parse mytex=3D3D > > t/text none > >>> =3D3D3D09=3D3D3D09=3D3D3D09 =3D3DA0 =3D3DA0 =3D3DA0ifo/text: join = "Wordcount: " > copy=3D > to-string m=3D3D > > ylen > >>> =3D3D3D09=3D3D3D09=3D3D3D09 =3D3DA0 =3D3DA0 =3D3DA0show if > >>> =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 = =3D3DA0 =3D3DA0 =3D3DA0 > =3D3DA0 =3D > =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3DA0 =3D3D > > =3D3DA0 =3D3DA0 ] > >>> > >>> But just adding the feel to the area doesn't work. > >>> > >>> What am i missing?? > >>> > >>> Thorsten > >>> > >>> > >>> -- > >>> http://www.fastmail.fm - IMAP accessible web-mail > >>> > >>> -- > >>> To unsubscribe from the list, just send an email to > >>> lists at rebol.com with unsubscribe as the subject. > >>> > >>> > >> > >> > >> > >> -- > >> To unsubscribe from the list, just send an email to > >> lists at rebol.com with unsubscribe as the subject. > >> > >> > > -- > > To unsubscribe from the list, just send an email to > > lists at rebol.com with unsubscribe as the subject. > > > > >=20 >=20 >=20 > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
