Can this be done faster ?
jbv
jbv.silences at club-internet.fr
Wed Jul 12 07:40:02 EDT 2006
Hi again,
I have some data that I need to process repeatedly and as
fast as possible.
first I have a variable V with numeric values > 0 (1 per line)
and some of them can repeat themselves in the list.
then, I need to build and array T in which keys are those numeric
values, and the data associated to each key is the number of times
each value appears in the list.
for instance, if V contains :
2
2
2
4
4
then, T contains :
T[2]=3
T[4]=2
I came up with some brute force loops :
put "" into T
repeat for each line j in V
put 0 into T[j]
end repeat
repeat for each line j in V
add 1 to T[j]
end repeat
but was wondering if it could be done even faster...
note : the original list of values can be pretty large (> 30000)...
Thanks,
JB
More information about the use-livecode
mailing list