Bugzilla 586, the fast char replacement (was Revolution compilation)

Dar Scott dsc at swcp.com
Sat Jan 8 13:24:22 EST 2005


On Jan 8, 2005, at 8:30 AM, Michael D Mays wrote:

> Are you saying that replacing 4 chars is fast or should be fast? I 
> can't make it fast. If it is suppose to be fast how do you do it?

on mouseUp
   put longString(100000) into x
   put the long seconds into a  -- OS X timing only
   put "yyyy" into char 4444 to 4447 of x
   put the long seconds into b
   put b-a
end mouseUp

function longString n
   put empty into s
   repeat n times
     put "x" after s
   end repeat
   return s
end longString

==>
.000008

(Mmmm.  This and single char are faster than last week, but the time 
grows slightly the first few times.)

You have to replace a char chunk with the same size string.

The timing test needs to be modified for Windows.  A crude timer:  Make 
a loop around the 'put' and do it 10,000 times and then divide the 
delta seconds by 10,000.

Dar

**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming Services and Software
**********************************************



More information about the use-livecode mailing list