On Tue, Feb 21, 2012 at 11:16 PM, Geoff Canyon Rev gcanyon+...@gmail.comwrote:
but
I've been fooled by the near-infinite speed of repeat for each too many
times to count.
Haven't we all.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Sorry got caught up on an issue...
So far things look very fast and seem to give the results I need (will
confirm as I use larger data sets that have a known answer).
But this does bring up a question and doing more than planned with the
final lists...
If the final list is kept in sequential
Depends on how big the list is. Unless there's a faster method than the one
I used (or you're using slower hardware than I am), you should be okay up
to about 100,000 rows using something like:
repeat for each line L in the keys of yourArray
if L 20 and L 60 then put L cr after R
On Tue, Feb 21, 2012 at 4:29 PM, Glen Bojsza gboj...@gmail.com wrote:
Or will Kay prove it to be faster
with just lists :-)
Already proven. I agree with Geoff. For the data example you have provided
and the queries you are suggesting, LC can easily handle it using repeat
for each line and an
I was thinking more along the lines (no pun intended) of
- find line number of starting value (for example line 578 )
- find line line number of ending value (for example 12125)
put lines 578 to 12125 into results
Can this be done verses looping through each line since we know the xs
column is
Glen,
Look at my test results more closely:
Finding the 1st item of the 1st line using direct reference = 3ms
Finding the last item of the last line using direct reference = 440294ms
Finding the -1 item of the 1st line using direct reference = 5ms
Finding the -1 item of the -1 line using direct
Then repeat for is King in Livecode!
thanks for everyone's feedback .
On Tue, Feb 21, 2012 at 2:52 AM, Kay C Lan lan.kc.macm...@gmail.com wrote:
Glen,
Look at my test results more closely:
Finding the 1st item of the 1st line using direct reference = 3ms
Finding the last item of the last
On Tue, Feb 21, 2012 at 4:29 PM, Glen Bojsza gboj...@gmail.com wrote:
For example a user wants an starting xs value of 10 and an ending xs value
of 40 I think that if the keys are sequential (the keys being the first
column - xs) then it would be a fast solution using arrays since you should
Once the final list has been made it could have up to 10 ?t columns but the
query is only for the lines identified as start and end based on the first
column which is xs.
There would be no other queries involving the data in the ?t columns the
whole line that meets the xs query is moved to a new
On Tue, Feb 21, 2012 at 3:52 AM, Kay C Lan lan.kc.macm...@gmail.com wrote:
repeat for each line L in the keys of yourArray
if L 20 then
put L cr after R
if L 60 then
exit repeat
end if
end if
end repeat
Don't waste cyling through
On Tue, Feb 21, 2012 at 8:36 AM, Glen Bojsza gboj...@gmail.com wrote:
The good news is that the lists may grow as high as 1,000,000 lines and are
as little as 30,000.
1,000,000 lines is pretty big. If you're guaranteed to be working on a
recent machine, then perhaps it would be okay. But
Pete wrote:
Interesting, and it kinda makes sense. For elements, there's no
positioning required like with lines/words/item, just a case of cycling
through the keys - which is what repeat for each line x in the keys of
array does I suppose.
As with most things in computing, the truly optimal
Even with repeat for each line, the chunk has to be parsed in memory for
returns before proceeding. An array is by nature already parsed. As has been
discussed before, the repeat for each command is so fast because it parses the
memory used by the chunk, creating a list of pointers (forgive me
Take for example retrieving a large data set from an SQL db. You can retrieve
it as a cursor, and array or a string. Cursors are read only and I don't see
the advantage of working with them. That leaves only arrays and strings. So if
you *can* get the data as an array, and sorting is not an
Bob Sneidar wrote:
Repeat for each line x in the keys of array y would seem at a glance
to have to reevaluate the keys of array each time through the loop,
wouldn't it? You must mean you get the keys first in a variable and
then use that.
If I understand how the engine treats that, it seems
You are probably right, I imagined in my mind that when the engine parses the
chunk, it had to already be in memory, as in a variable or array. Since the
thing being parsed was a statement that evaluated to something, it seemed that
the engine would have nothing in existence to parse to begin
As Richard said, the engine is smart enough to avoid this pitfall. So no,
it's perfectly fine to say
repeat for each line x in the keys of array y
even if the list of keys is large.
On Tue, Feb 21, 2012 at 12:03 PM, Bob Sneidar b...@twft.com wrote:
Repeat for each line x in the keys of array
On Feb 19, 2012, at 10:42 PM, dunb...@aol.com wrote:
Kay's is much faster than mine.
Don't worry about it, it happens to just about every person who's had
experience with HyperCard when they come over to LiveCode: the repeat for
each aha! moment: any time you find yourself writing:
repeat
Also each element in array
Bob
On Feb 20, 2012, at 10:34 AM, gcanyon+rev wrote:
any time you find yourself writing:
repeat with i = 1 to the number of lines|words|items of someContainer
stop. Rewrite it as:
repeat for each line|word|item in someContainer
Bob,
Can you give a quick example of this? I have always used for each line in the
keys of array.
Thanks
Mike
Sent from my BlackBerry device on the Rogers Wireless Network
-Original Message-
From: Bob Sneidar b...@twft.com
Sender: use-livecode-boun...@lists.runrev.com
Date:
ON mouseUp pMouseBtnNo
put the dgData of group dgTableData into theDataA
REPEAT FOR each element theRecordA in theDataA
add 1 to theItemNum
put theRecordA[reservationid] into item theItemNum of
theReservationList
END REPEAT
put theReservationList
END mouseUp
I
I tend to use for each line in the keys also, mainly because element
returns the contents of the array and I often find myself needing to know
the key value. Plus if you need to get the array elements in key sequence,
I think you have put the keys into a variable and sort them then base the
Pete, you are correct. Lines of the keys are not sorted.
Bob, thanks. I have not ever seen element used before. Interesting.
-= Mike
Sent from my BlackBerry device on the Rogers Wireless Network
-Original Message-
From: Pete p...@mollysrevenge.com
Sender:
Certainly correct, but there is not the tremendous performance advantage to
using for each element in... For items, lines, and words, using
item/line/word of myContainer gets worse the larger the container is. For
character and with arrays, it doesn't. In my quick testing here, there's
just about
Interesting, and it kinda makes sense. For elements, there's no
positioning required like with lines/words/item, just a case of cycling
through the keys - which is what repeat for each line x in the keys of
array does I suppose.
Pete
On Mon, Feb 20, 2012 at 6:20 PM, Geoff Canyon Rev
On Feb 20, 2012, at 9:37 PM, Kay C Lan wrote:
Anyone want to test the speed of finding data in a 100 line variable
using char -1 of word -1 of item -1 of line -1?
Hi, Kay. Sure. How do I get the script?
I'd guess that almost all the time goes into the line -1, and within that line
You can get away with straight text for small data sets, but I would never
suggest using a single variable and line references for random access on
anything more than a few tens of thousands of lines -- although I will
point out that in your test, even working with a million lines meant a
worst
Having limited experience with arrays I thought this might be a good
question to ask the group.
Is the use of arrays to solve this appropriate? Efficient? Fast?
If the answers are yes then it will help with the bigger problem that I am
trying to address but for now I am looking for advice or
Glen.
I sort of get what you are trying to do, and yes, arrays will be the most
compact way to do it, though regular variables can work as well.
But what happens if you already have the xs values in conecutive by 10
order? Are you allowed to bump later values by 10? In other words, are you
The xs values should only be bumped if the preceding xs value is not the
one in sequence using 10 as the increment. No xs value (other than the very
first one or the very last one cannot have a neighboring xs value within
the increment range.
for example
xs wt
10 6
80 7
13023
On Mon, Feb 20, 2012 at 2:53 AM, Glen Bojsza gboj...@gmail.com wrote:
Is the use of arrays to solve this appropriate? Efficient? Fast?
From another recent thread, using arrays is slower than repeat for each
line, and if the values you give are realistic (not lines with 1 chars)
then even
Whoops typo,
the start dummy list is
10 6
80 7
130 23
140 2
160 22 --- 160, not 150
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
Here's the same solution, but with 101 records. On my machine, over 3
runs I get, 4924 millisec, 4932 ms, 4914 ms.
I'm sure others will now improve on that.
There are a couple of extra lines to do the timing which you'd remove for
your solution.
on mouseUp
--create the dummy list
put
Hi Kay,
This looks very good mainly the use of case with the decision being the
switch... never thought about that.
Also, I didn't realize that arrays would be slower... I will test this with
some of the data sets ... currently up to 80,000 lines but with values I
have indicated... but I like
I am an old HyperCarder, so I tend to attack things in an old fashioned way. I
use arrays, but think that the decisions needed here may not use them to any
great advantage. I am usually wrong.
I tried this with a worst case list of 20,000 lines, that is, no adjacent lines
in your sense, to
Kay's is much faster than mine.
Well done.
Craig Newman
-Original Message-
From: Glen Bojsza gboj...@gmail.com
To: How to use LiveCode use-livecode@lists.runrev.com
Sent: Sun, Feb 19, 2012 9:49 pm
Subject: Re: How to use an array to solve the following...
Hi Kay,
This looks very
On Mon, Feb 20, 2012 at 10:47 AM, Glen Bojsza gboj...@gmail.com wrote:
The biggest picture would be having 10 lists with each list having the xs
column but a different ?t column (wt, gt, st, mt, qt, ... etc)
If you are going to many more columns, then an array might be faster, and
if speed
On Feb 19, 2012, at 8:47 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:
I'm sure others will now improve on that.
I doubt it. You're using repeat for each in a sensible way, and there's rarely
something faster than that.
If you really wanted to tighten up the repeat, you could do something
38 matches
Mail list logo