Slowdown when putting symbols into image data
Alex Tweedly
alex at tweedly.net
Wed Sep 10 09:28:56 EDT 2014
On 10/09/2014 00:17, Alex Tweedly wrote:
> I'll go experiment ....
>
> -- Alex.
Experimenting with copying a block of bytes in 7.0.0 RC1
Script is included in its entirety below - but basically it creates a
block of 1000 lines, 27K chars/bytes
It then repeatedly copies over a section of 104 bytes, or 104 chars or 4
lines (i.e. 104 chars)
As expected, copying by line is slower than by char or byte, and becomes
increasingly slower as we choose lines further into the data.
In 6.7 (DP1), the times to copy chars or bytes are equal and very small,
while the number for lines is quite small.
In 7.0 RC1, the times are all *MUCH* larger - to the point where I'd
say 7.0 is unacceptable.
And in addition, copying bytes takes over twice as long as copying chars
- when if anything it should be the other way round.
7.0 RC1
bytes took 313
chars took 137
lines took 4058
6.7 (DP4)
bytes took 8
chars took 8
lines took 411
i.e. 7.0 is 40 times slower for copying a block of data !!
I'll try to enter a bug report and when (if) I succeed, I'll post the
number here.
-- Alex.
constant K = 10 -- which gives 2**10 lines of data
constant KSTART = 4 -- starting offset - large numbers should make lines
slow, but not affect bytes
constant COUNT = 20000 -- make this big enough to get useful data
on mouseUp
-- setup
local tt, tStartData, cPos1, cPos2, t1, t2
put "abcdefghijklmnopqrstuvwxyz" & CR into tt
repeat K times
put tt after tt
end repeat
put tt into tStartData
put "data has" && the number of lines in tStartData && the number of
bytes in tStartData &CR after fld 1
put the number of chars in line 1 to KSTART of tStartData into cPos1
put the number of chars in line 1 to kSTART + 4 of tStartData into cPos2
put the millisecs into t1
repeat COUNT times
put byte 1 to cPos2 - cPos1 +1 of tt into byte cPos1 to cPos2 of
tStartData
end repeat
put the millisecs into t2
put "bytes took " && t2 - t1 &CR after msg
put the millisecs into t1
repeat COUNT times
put char 1 to cPos2 - cPos1 +1 of tt into char cPos1 to cPos2 of
tStartData
end repeat
put the millisecs into t2
put "chars took " && t2 - t1 &CR after msg
put the millisecs into t1
repeat COUNT times
put line KSTART to KSTART+4 of tt into line KSTART to KSTART+4 of
tStartData
end repeat
put the millisecs into t2
put "lines took " && t2 - t1 &CR after msg
end mouseUp
More information about the use-livecode
mailing list