On Mon, Sep 1, 2014 at 5:58 PM, Geoff Canyon wrote:
> All justifications aside, I'd use method 3 all the time unless something
> broke. ;-)
>
A recent post on a similar topic (filtering lines by filetype from the
output of "the files") made me think of this thread again.
I tried Alex's test aga
On Sun, Aug 31, 2014 at 4:04 PM, Alex Tweedly wrote:
> I also added method4, which tries to get the best of both worlds. It
> restricts the additional memory usage (by building up a second variable,
> but removing sections of the input variable at the same time), and also
> does relatively few d
Thanks to j...@souslelogo.com for the suggestion that hasMemory(bytes)
might be useful. I haven't tried this yet.
Thanks to for replies to my other
questions.
On the memory cost of writing fld "data" to tVar
Q2. Of course it does, but the same condition is in place in all three
tests.
Hi Alex
Agreed. And your #4 is a nice solution.
Hugh Senior
FLCo
From: Alex Tweedly
Hugh,
The condition you've chosen for deciding whether to delete the line is
whether or not the line is empty.
So in method 2, replacing those lines by "" has no effect on the data.
That is, I think, an in
hasMemory may indeed be of some use, but I have had problems with it in the
past. Besides, as has been pointed out, anything that is likely to drain all
memory should probably be served from a database anyway.
heapSpace is for HC/SC compatibility and does not map on all (if any)
platforms.
From:
Hugh,
The condition you've chosen for deciding whether to delete the line is
whether or not the line is empty.
So in method 2, replacing those lines by "" has no effect on the data.
That is, I think, an inadequate benchmark. The primary cost you would
encounter in the real case with method 2
>
> 1. Is there a good way to determine ahead of time whether memory is an
> issue? When I start the handler I can find out how big tVar is, but how do
> I find out how much memory is available?
>
Could the function hasMemory(bytes) be of some help ?
Or perhaps heapSpace() on Mac OS systems ?
j
>From David Epstein
Q1. Not that I know of.
Q2. Of course it does, but the same condition is in place in all three
tests. And the data has to come from somewhere.
Q2. This 'repeat for each' rule refers to not modifying whatever 'each'
refers to. In this case, 'each' is a line and the number of lin
Hi
> Some benchtesting...
>
> Task:
> Strip lines where a given condition is met.
Have you tried the following method (condition is "line empty") :
on mouseUp
set the cursor to watch
put the long seconds into tStart
put fld "Data" into tVar
repeat while tVar contains (return & r
the line numbers of tDat will get rearranged dynamically after each
> deletion,
> whereas the line numbers contained in tDeletions are static.
> Won't it mess up the whole thing?
>
> Regards,
> Sri
>
>
>
> --
> View this message in context:
> http://r
tDeletions are static.
Won't it mess up the whole thing?
Regards,
Sri
--
View this message in context:
http://runtime-revolution.278305.n4.nabble.com/Speed-testing-Fastest-search-method-tp4682719p4682730.html
Sent from the Revolution - User mailing list archive at Nabbl
Heres the code i'm testing with.
on mouseUp
--## First Method, delete line
put field "dat" into tDat
put the number of lines in tDat into tLines
put the millisec into tStart
put 1 into x
repeat for each line tLIne in tDat
if item 1 of tLine < 40 then
put x & comma
Thanks Hugh. I guess I'll be careful about where I use method 1 in
future!
I would expect method 1 to take longer but that's a huge difference. I
wonder if this would speed it up:
Put the number of lines in tVar into tCount
Repeat with x=tCount down to 1
Pete
lcSQL Software
On Aug 31, 2014 2:5
Method 2 doesn't have the filter, I am guessing the lack is a typo? Also,
I'd be interested in your results with the repeat for each method that
modifies tvar with the direct line deletion, though thinking about it,
(since i'm awake now) it wouldn't work unless it was modified. Something
like..
compared 3 methods of stripping lines from a
variable, and concluded:
If memory is an issue, then Method 2 is best
If memory is not an issue, then Method 3 is best
3 questions:
1. Is there a good way to determine ahead of time whether memory is an issue?
When I start the handler I can find
Some benchtesting...
Setup:
LC7DP10, Windows 7
Source data:
10,000 lines of random data
100 chars per line
3,346 empty lines
Task:
Strip lines where a given condition is met.
Results:
Method 1
Operating on a single variable, 'repeat with' + delete line
25.586 sec
16 matches
Mail list logo