Re: Which is faster...

2023-12-15 Thread J. Landman Gay via use-livecode
I asked this back in the early MetaCard days and received a one word answer: "variables". It's nice to know the reason behind it, and that it hasn't changed. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On December 15, 2023 9:01:34 AM M

Re: Which is faster...

2023-12-15 Thread Bob Sneidar via use-livecode
Ah! Another mystery solved. My app runs as a standalone considerably faster that in the IDE. Bob S On Dec 15, 2023, at 7:00 AM, Mark Waddingham via use-livecode wrote: The above results are run in the IDE which is important to mention because the message path in the IDE is typically longer

Re: Which is faster...

2023-12-15 Thread Bob Sneidar via use-livecode
Good point. I always put data I intend to work on in a local variable anyway so it becomes easier to debug. As far as 1,000,000 iterations, I cannot imagine what anyone developing in Livecode who would want to do that inline with any other process. But then I failed 6th grade math, sooo….. there

Re: Which is faster...

2023-12-15 Thread Paul Dupuis via use-livecode
And that is THE DEFINITIVE answer! Wow! Thank you. On 12/15/2023 10:00 AM, Mark Waddingham via use-livecode wrote: On 2023-12-14 21:22, Paul Dupuis via use-livecode wrote: Which is faster or more efficient (from an engine performance perspective)? To retrieve an array from a property? As in

Re: Which is faster...

2023-12-15 Thread Craig Newman via use-livecode
This is why LCMark gets the big bucks. Craig > On Dec 15, 2023, at 10:00 AM, Mark Waddingham via use-livecode > wrote: > > On 2023-12-14 21:22, Paul Dupuis via use-livecode wrote: >> Which is faster or more efficient (from an engine performance perspective)? >> To

Re: Which is faster...

2023-12-15 Thread Mark Waddingham via use-livecode
On 2023-12-14 21:22, Paul Dupuis via use-livecode wrote: Which is faster or more efficient (from an engine performance perspective)? To retrieve an array from a property? As in: command someHandler -- in an objects script   get the cMyArray from me -- cMyArray is some multi-dimensional array

Re: Which is faster...

2023-12-15 Thread Craig Newman via use-livecode
Sneidar via use-livecode wrote: >>>> I think the confusion comes from thinking so much of a stack as an object >>>> that has substance, when really all the properties are places in memory >>>> just like a memory variable is. I asked this some years back and the &g

Re: Which is faster...

2023-12-14 Thread Bob Sneidar via use-livecode
ust like a memory variable is. I asked this some years back and the answer >>> I got was that there is no appreciable difference. >>> >>> One could always devise a test though… >>> >>> Bob S >>> >>> >>> On Dec 14, 2023, at 1:22

Re: Which is faster...

2023-12-14 Thread Craig Newman via use-livecode
at has substance, when really all the properties are places in memory >>>> just like a memory variable is. I asked this some years back and the >>>> answer I got was that there is no appreciable difference. >>>> >>>> One could always devise a test thoug

Re: Which is faster...

2023-12-14 Thread Craig Newman via use-livecode
a stack as an object >>> that has substance, when really all the properties are places in memory >>> just like a memory variable is. I asked this some years back and the answer >>> I got was that there is no appreciable difference. >>> >>> One could alw

Re: Which is faster...

2023-12-14 Thread Paul Dupuis via use-livecode
On 12/14/2023 5:25 PM, Craig Newman via use-livecode wrote: Anything to distract me from my day job. Glad I could help! And thank you for the confirming benchmarks! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to s

Re: Which is faster...

2023-12-14 Thread Craig Newman via use-livecode
no appreciable difference. >> >> One could always devise a test though… >> >> Bob S >> >> >> On Dec 14, 2023, at 1:22 PM, Paul Dupuis via use-livecode >> wrote: >> >> Which is faster or more efficient (from an engine performanc

Re: Which is faster...

2023-12-14 Thread Paul Dupuis via use-livecode
, at 1:22 PM, Paul Dupuis via use-livecode wrote: Which is faster or more efficient (from an engine performance perspective)? To retrieve an array from a property? As in: command someHandler -- in an objects script get the cMyArray from me -- cMyArray is some multi-dimensional array ... end

Re: Which is faster...

2023-12-14 Thread Bob Sneidar via use-livecode
devise a test though… Bob S On Dec 14, 2023, at 1:22 PM, Paul Dupuis via use-livecode wrote: Which is faster or more efficient (from an engine performance perspective)? To retrieve an array from a property? As in: command someHandler -- in an objects script get the cMyArray from me -- cMyArray

Which is faster...

2023-12-14 Thread Paul Dupuis via use-livecode
Which is faster or more efficient (from an engine performance perspective)? To retrieve an array from a property? As in: command someHandler -- in an objects script   get the cMyArray from me -- cMyArray is some multi-dimensional array   ... end someHandler OR To retrieve an array from a

Re: which is faster for searching?

2014-08-31 Thread Alex Tweedly
ar of stdout=cr then delete last char of stdout return stdout If there are no matching lines (worst case), then this would require a 100% memory overhead. I am obviously mis-reading you. Hugh Senior FLCo From: Alex Tweedly To: use-livecode@lists.runrev.com Subject: Re: which is faster for s

Re: which is faster for searching?

2014-08-31 Thread FlexibleLearning.com
last char of stdout return stdout If there are no matching lines (worst case), then this would require a 100% memory overhead. I am obviously mis-reading you. Hugh Senior FLCo From: Alex Tweedly To: use-livecode@lists.runrev.com Subject: Re: which is faster for searching? Two comments 1.

Re: which is faster for searching?

2014-08-30 Thread Peter Haworth
Good info Alex. My only comment in response is that if I had 10 million lines of data to process, I wouldn't be doing it in memory, I'd probably be using an SQL database with an appropriate SELECT statement to get only the lines I wanted. Horses for Courses as they say :-) Pete lcSQL Software

Re: which is faster for searching?

2014-08-30 Thread Alex Tweedly
Two comments 1. The two methods below produce different results - the latter one removes lines that were empty in the original input data, the other doesn't (unless that happens to match "data condition on line x"). 2. In the case of large (or huge) datasets, Hugh's concern about avoidi

Re: which is faster for searching?

2014-08-30 Thread Peter Haworth
Seems like the times you're getting are a lot longer than I'd expect even allowing for repeat with performance so maybe that's it. Perhaps it's a factor of the condition you're testing for and how many lines are deleted. Pete lcSQL Software Home of lcStackBrowser

Re: which is faster for searching?

2014-08-30 Thread J. Landman Gay
On 8/30/2014, 1:04 PM, Jerry Jensen wrote: The dictionary says you shouldn't mess with tVar within the loop: Pasted from the dictionary: "Important! In any of the for each loops, you should not change the labelVariable or container in a statement inside the loop. Doing so will not cause a script

Re: which is faster for searching?

2014-08-30 Thread Jerry Jensen
On Aug 30, 2014, at 12:45 AM, FlexibleLearning.com wrote: > My stock method (and presumably the method you allude to above) is... > > repeat for each line L in tVar >add 1 to x >if then put "" into line x of tVar > end repeat > filter tVar without empty The dictionary says you shouldn

Re: which is faster for searching?

2014-08-30 Thread Mike Bonner
Hugh, just did a test.. Rather than putting empty into the line and then filtering without empty, seems to be quite a bit faster to "then delete line x of tVar" Still has the slowdown caused by accessing the lines of the var using "line x of.." but saves the time for the filter. With the data I ge

Re: which is faster for searching?

2014-08-30 Thread FlexibleLearning.com
Peter Haworth wrote > There's another situation where I use repeat with even though it's a little > slower than repeat for and I also alter the contents of the data I'm > repeating through without any problems. > > repeat with x=the number of lines in tVar down to to 1 >if then > delet

Re: which is faster for searching?

2014-08-29 Thread Peter Haworth
I think it's worth pointing pout that the faster operation of repeat for only applies if you're referencing Livecode chunks in the loop. For example, if you have a numerically keyed array, there's nothing wrong with: put the extents of tArray into tExtents repeat with x= item 1 of tExtents to ite

Re: which is faster for searching?

2014-08-29 Thread Beat Cornaz
Bob Sneidar wrote : > T he reason for all this is that to optimize the repeat loop, the engine > makes one pass through the data, and creates an index of pointers to the > delimiters. If you modify the data, the OS may (and probably will) do some > memory shuffling > and the pointers will no lo

Re: which is faster for searching?

2014-08-28 Thread Bob Sneidar
Repeat for each has been optimized to run faster than other forms of repeat. Use whenever you can. One word of caution though: Do NOT change the value of what you are repeating. (Whatever comes after “in”.) I am pretty sure you should not alter the value returned (the variable after "each ”).

Re: which is faster for searching?

2014-06-18 Thread jbv
Regarding code such as : repeat for each line j in myVar if item 1 of j > 1 and item 2 of j > tMin and item 3 of j < tMax then end if end repeat I remember a discussion several years ago on this very list mentioning that in the "if" line, the engine would drop evaluation as soon

Re: which is faster for searching?

2014-06-18 Thread Richard Gaskin
"Filter" is a wonderful command that's almost always much faster than "repeat for each...", provided you're looking for data across a collection comprised of single-column rows. Once you get to multiple columns and you're searching just one of them, "repeat for each..." scales linearly quite n

Re: which is faster for searching?

2014-06-17 Thread Magicgate Software - Skip Kimpel
Yes, my 500,000 lines of text are about 2000 characters long and has multiple criteria applied against it. The text file that it is analyzing is about 200MB. I am very happy with "a couple of seconds." :) On Tue, Jun 17, 2014 at 8:59 PM, Kay C Lan wrote: > On Wed, Jun 18, 2014 at 4:18 AM, Pe

Re: which is faster for searching?

2014-06-17 Thread Kay C Lan
On Wed, Jun 18, 2014 at 4:18 AM, Peter Haworth wrote: > I put 500,000 lines... > The repeat loop took 153 ms and the filter took 38ms. That's more like it. Skip's 'just a couple of seconds' must have been for some extremely long lines of difficult data with some very convoluted search criteria. F

Re: which is faster for searching?

2014-06-17 Thread Peter Haworth
n exactly is it? > Larry > > - Original Message - From: "Peter Haworth" > To: "How to use LiveCode" > Sent: Tuesday, June 17, 2014 11:25 AM > Subject: Re: which is faster for searching? > > > You might want to try the filter command too, especially

Re: which is faster for searching?

2014-06-17 Thread jbv
less lines of code is often more elegant but not always easy to maintain, and quite some times doesn't mean faster execution... jbv > I think it came in with 6.5. Would be interesting to see how it performs > compared to a repeat loop. I always like less lines of code as ling as > things still

Re: which is faster for searching?

2014-06-17 Thread Peter Haworth
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html> On Tue, Jun 17, 2014 at 11:17 AM, wrote: > Thanks Pete, > Which version exactly is it? > Larry > > - Original Message - From: "Peter Haworth" > To: "How to use LiveCode" > Sent: Tuesday

Re: which is faster for searching?

2014-06-17 Thread jbv
> I used the "for each line" in a recent project that evaluates 500,000 > lines > and takes just a couple of seconds to complete. It is VERY fast! > > SKIP > I guess the reason it's fast is because it implements the equivalent C loop in a very raw manner... jbv

Re: which is faster for searching?

2014-06-17 Thread larry
Thanks Pete, Which version exactly is it? Larry - Original Message - From: "Peter Haworth" To: "How to use LiveCode" Sent: Tuesday, June 17, 2014 11:25 AM Subject: Re: which is faster for searching? You might want to try the filter command too, especially the

Re: which is faster for searching?

2014-06-17 Thread Magicgate Software - Skip Kimpel
ne..." since that was easy and fast > Larry > > - Original Message - From: > To: "How to use LiveCode" > Sent: Tuesday, June 17, 2014 8:38 AM > Subject: Re: which is faster for searching? > > > > Larry, >> >> "repeat for e

Re: which is faster for searching?

2014-06-17 Thread Peter Haworth
You might want to try the filter command too, especially the new version that has a lot more options including the ability to put the qualifying lines into a different container. Pete lcSQL Software Home of lcStackBrowser and SQLite

Re: which is faster for searching?

2014-06-17 Thread larry
Thanks to Mark and jbv for the good advice. I ended up using the "for each line..." since that was easy and fast Larry - Original Message - From: To: "How to use LiveCode" Sent: Tuesday, June 17, 2014 8:38 AM Subject: Re: which is faster for searching? Larr

Re: which is faster for searching?

2014-06-17 Thread Mark Schonewille
Hi Larry, If you want to do a one-time search, possible invoked by a user action, 3000 lines is nothing. Don't bother about speed and just use the most convenient way to search. If you want to search repeatedly without user interactions between the searches, speed may be important. In that c

Re: which is faster for searching?

2014-06-17 Thread jbv
Larry, "repeat for each line..." is definitely faster and repeat for each line j in myVar if j contains myText then end if end repeat should be pretty fast. jbv > I have a large variable containing about 3000 lines of data - each line > about 100 characters. > > I want to s

which is faster for searching?

2014-06-17 Thread larry
I have a large variable containing about 3000 lines of data - each line about 100 characters. I want to search through the variable and find all the lines that contain a specified string Should I use (repeatedly) "lineoffset...", or should I use "repeat for each line..." or maybe some other f