use-livecode Digest, Vol 250, Issue 1
Niggemann, Bernd
Bernd.Niggemann at uni-wh.de
Sun Jul 28 15:10:04 EDT 2024
Hi David,
Here is a script that lets you compare filter operations on lists or arrays. With and without unicode.
put it into a button and make a field "fRes" and hold down the option/alt key to test unicode, else it is ASCII.
-----------------------------------------------------
on mouseUp
put 10000 into tHowMany
-- hold down optionKey/altKey to use unicode
put the optionKey is down into tUnicode
if tUnicode then
put "a horse is a horse,a chicken is a" & \
" Höfuðborgarsvæðið,a dog is a dog" into tData ## with unicode
else
put "a horse is a horse,a chicken is a " & \
"chicken,a dog is a dog" into tData ## without unicode
end if
repeat tHowMany
put any item of tData & cr after tCollect
end repeat
delete char - 1 of tCollect
put tCollect into tList
put tCollect into tForArray
if tUnicode then
put the milliseconds into t1
filter tList with "*Höfuðborgarsvæðið*" ## with unicode
put the milliseconds - t1 into tListTime
put the milliseconds into t1 ## include split
split tForArray by return
-- put the milliseconds into t1 ## without split
filter elements of tForArray with "*Höfuðborgarsvæðið*" ## with unicode
combine tForArray by return
put the milliseconds - t1 into tArrayTime
else
put the milliseconds into t1
filter tList with "*dog*" ## without unicode
put the milliseconds - t1 into tListTime
-- put the milliseconds into t1 ## include split
split tForArray by return
put the milliseconds into t1 ## without split
filter elements of tForArray with "*dog*" ## with unicode
combine tForArray by return
put the milliseconds - t1 into tArrayTime
end if
put "Unicode: " & tUnicode & ", Lines: " & tHowMany & cr & "List: " & \
tListTime & " ms" & cr & "Array: " & tArrayTime & " ms" \
& cr & the long time into field "fRes"
end mouseUp
-----------------------------------------------------
Kind regards
Bernd
More information about the use-livecode
mailing list