Re: Has Anyone Got A Directory \\\"Walker\\\" Available

2018-05-07 Thread Brian Milby via use-livecode
I think we may be in the territory of pre-mature optimization. There is going to be a bit more overhead creating a copy-on-write object than a pass-by-reference object, but the real gains (over the old way) are going to be seen with objects that are “large”. If you run a profiler and need to

Re: Has Anyone Got A Directory \\\"Walker\\\" Available

2018-05-07 Thread Richard Gaskin via use-livecode
Mark Wieder wrote: > On 05/06/2018 02:42 PM, Richard Gaskin via use-livecode wrote: > >> Did copy-on-write get changed in v9, or is the scope of its effects >> just more limited than I had understood it to be? > > I'm still at the point of not trusting copy-on-write yet, but I think > you're

Re: Has Anyone Got A Directory \\\"Walker\\\" Available

2018-05-06 Thread Mark Wieder via use-livecode
On 05/06/2018 02:42 PM, Richard Gaskin via use-livecode wrote: Did copy-on-write get changed in v9, or is the scope of its effects just more limited than I had understood it to be? I'm still at the point of not trusting copy-on-write yet, but I think you're misinterpreting your results. If

Re: Has Anyone Got A Directory \"Walker\" Available

2018-05-06 Thread Alex Tweedly via use-livecode
I doubt if it would work out faster. A quick test of  time ls -lR > null gives 166 ms vs. the 179 I get from the non-recursive tree walker - so by the time you gather that output, and re-format back to something more usable, I think you'd probably come out the same or slower. Alex. On

Re: Has Anyone Got A Directory "Walker" Available

2018-05-06 Thread Alex Tweedly via use-livecode
On 06/05/2018 20:12, Richard Gaskin via use-livecode wrote: Ah, that makes sense.  It's not so much the recursion per se, but the more general advantage of inline processing vs handler calls. Exactly. In the test case below you know how many levels deep you're going, which seems a good fit

Re: Has Anyone Got A Directory \"Walker\" Available

2018-05-06 Thread Stephen Barncard via use-livecode
there's actually a directory walker search one can use in a shell command on mac that is quite speedy... let me report back. sqb -- Stephen Barncard - Sebastopol Ca. USA - mixstream.org On Sun, May 6, 2018 at 2:29 PM, Richard Gaskin via use-livecode < use-livecode@lists.runrev.com> wrote: >

Re: Has Anyone Got A Directory \\\"Walker\\\" Available

2018-05-06 Thread Richard Gaskin via use-livecode
Bernd wrote: > Richard wrote: >> Which version of LC did you test with? >> I was under the impression that since LC switched to copy-on-write >> for all >arguments we should no longer need to use "@" for >> performance, only for for logic. > > > I tested using LC 9 GM, what kind of results do you

Re: Has Anyone Got A Directory \"Walker\" Available

2018-05-06 Thread Richard Gaskin via use-livecode
Malte Pfaff-Brill wrote: > I wonder if shelling out to DIR on Windows and LS on Linux/Mac > wouldn’t be the fastest option… Maybe, but there's overhead in setting up the shell session. Even if it's measurably faster, I would be surprised if it were noticeably faster. Anything that depends

Re: Has Anyone Got A Directory \\\"Walker\\\" Available

2018-05-06 Thread Niggemann, Bernd via use-livecode
>Which version of LC did you test with? >I was under the impression that since LC switched to copy-on-write for all >>arguments we should no longer need to use "@" for performance, only for for >logic. Richard, I tested using LC 9 GM, what kind of results do you get? Kind regards Bernd

Re: Has Anyone Got A Directory \"Walker\" Available

2018-05-06 Thread Malte Pfaff-Brill via use-livecode
I wonder if shelling out to DIR on Windows and LS on Linux/Mac wouldn’t be the fastest option… Cheers, Malte ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription

Re: Has Anyone Got A Directory \"Walker\" Available

2018-05-06 Thread Richard Gaskin via use-livecode
Bernd Niggemann wrote: > a combination of "private" and referenced variables (@) improves the > speed of the calls somewhat. Which version of LC did you test with? I was under the impression that since LC switched to copy-on-write for all arguments we should no longer need to use "@" for

Re: Has Anyone Got A Directory \"Walker\" Available

2018-05-06 Thread Niggemann, Bernd via use-livecode
Alex, a combination of "private" and referenced variables (@) improves the speed of the calls somewhat. Kind regards Bernd -- on mouseup local t1, t2 constant K = 1000 local x constant KX = 100 put the millisecs into t1 repeat K

Re: Has Anyone Got A Directory "Walker" Available

2018-05-06 Thread Richard Gaskin via use-livecode
Ah, that makes sense. It's not so much the recursion per se, but the more general advantage of inline processing vs handler calls. In the test case below you know how many levels deep you're going, which seems a good fit for inline loops. But how do we handle cases like directory traversal,

Re: Has Anyone Got A Directory "Walker" Available

2018-05-05 Thread Alex Tweedly via use-livecode
On 05/05/2018 01:29, Richard Gaskin via use-livecode wrote: How does recursion impair performance so significantly? In general, there's significant work involved in a function or handler call and return - you need to establish a new context for locals, copy or calculate, parameters, etc.  My

Re: Has Anyone Got A Directory "Walker" Available

2018-05-04 Thread Richard Gaskin via use-livecode
Alex Tweedly wrote: > Avoiding recursion is (almost) always a good idea, if it can be > done without jumping through hoops; for a file walker I timed it > (a couple of years ago) at somewhere between 20 and 35% faster. How does recursion impair performance so significantly? -- Richard Gaskin

Re: Has Anyone Got A Directory "Walker" Available

2018-05-03 Thread Alex Tweedly via use-livecode
Thanks Ben - that's pretty similar to what I use. Avoiding recursion is (almost) always a good idea, if it can be done without jumping through hoops; for a file walker I timed it (a couple of years ago) at somewhere between 20 and 35% faster. And it's so much easier to add a good progress

Re: Has Anyone Got A Directory "Walker" Available

2018-05-03 Thread Ben Rubinstein via use-livecode
FWIW I don't use recursion for directory walking. My typical routine (typing directly into email, may contain errors) is something along the following lines: -- assumes tRootFolder is the path to start reviewing put return into tFoldersToDo repeat until tFoldersToDo =

Re: Has Anyone Got A Directory "Walker" Available

2018-04-21 Thread Ali Lloyd via use-livecode
Ah, it will throw an error - so best to use try / catch around the function calls. On Sat, Apr 21, 2018 at 9:13 AM Ali Lloyd wrote: > Now that we have files(pFolder), folder(pFolder) (and files(pFolder, > "detailed"), folders(pFolder, "detailed")), directory walking code

Re: Has Anyone Got A Directory "Walker" Available

2018-04-21 Thread Ali Lloyd via use-livecode
Now that we have files(pFolder), folder(pFolder) (and files(pFolder, "detailed"), folders(pFolder, "detailed")), directory walking code can be improved somewhat by not having to set the current folder. Actually, I haven't checked what happens when you get files(pRestrictedFolder) On Fri, Apr 20,

Re: Has Anyone Got A Directory "Walker" Available

2018-04-20 Thread Richard Gaskin via use-livecode
You may recall the dreaded recursion errors that have cropped up in discussions of directory walkers. They happen not because anyone has directory trees > 40,000 folders deep, but because a permissions restriction can prevent going into a subdirectory, causing the current directory to be

Re: Has Anyone Got A Directory "Walker" Available

2018-04-19 Thread Paul Hibbert via use-livecode
> On 19 Apr 2018, at 11:20, Sannyasin Brahmanathaswami via use-livecode > > wrote: > > Never mind… > > I found this in a toolbox. Sent by some ago, by a LiveCode deva That looks very much like the code supplied under the