Paul Dupuis wrote:
> For strange legacy application reasons, when lines get added to the
> set of fields (a frequency action by users - sometimes adding hundreds
> of lines a day), the data has to be repackaged into this tab delimited
> structure in a single variable to run some procedures on.
>
Wow, what a great example. I decided to work through the various suggestions
just so I could get a better grip on some of LC’s more sophisticated data
handling commands.
My original run using Paul’s example was 8 seconds (2000 lines per field, 1100
chars per line)
Applying Brian’s simple
Short version: inserting between is a much slower process than after, as the
entire field/string/whatever from the post of insertion has to be moved or
otherwise handled.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this
Thank you!
The prior solutions have dramatically reduced the time - the WHOLE
analytics process in its entirety because of the slowness of my old code
was taking HOURS (like 6-10) - and is now down to 30-35 minutes with the
prior solutions. I can't wait to tr the combine by columns method to
I can't answer for anyone else, but for me - because I never thought
about it :-)
Combine by column - never used it before, so never thought of it.
It's significantly faster, roughly 40% improvement over the previous best.
Note, the spec requires that each line begins with the line number, so
I didn’t text the speed, but why not
put fld A into x[1]
put fld B into x[2]
put fld C into x[3]
put fld D into x[4]
combine x by column
return x
>
> I have a set of fields, call them A, B, C, and D. Each has the same
> number of lines. Each field has different text (per line)
>
> I need to
On 8/19/2022 7:40 PM, Mark Wieder via use-livecode wrote:
On 8/19/22 16:31, Alex Tweedly via use-livecode wrote:
to trim about another 15% off the time (for my sample data, 24ms down
to 20ms.)
Nice.
Note, of course, that we're all going on the assumption that all four
fields contain the
On 20/08/2022 00:03, Bob Sneidar via use-livecode wrote:
It's probably a lot of text. The engine has to start from the beginning of
every string then scan through for every cr or lf or cr/lf or whatever counts
as a line break, until if finds the nth one. The more lines, the longer the
scan
On 8/19/22 16:03, Bob Sneidar via use-livecode wrote:
It's probably a lot of text. The engine has to start from the beginning of
every string then scan through for every cr or lf or cr/lf or whatever counts
as a line break, until if finds the nth one. The more lines, the longer the
scan takes
On 8/19/22 16:31, Alex Tweedly via use-livecode wrote:
to trim about another 15% off the time (for my sample data, 24ms down to
20ms.)
Nice.
Note, of course, that we're all going on the assumption that all four
fields contain the same number of lines.
--
Mark Wieder
ahsoftw...@gmail.com
On 19/08/2022 23:32, Mark Wieder via use-livecode wrote:
It is indeed faster. Here's what I came up with. I'm not sure why 2000
lines of text in four fields should take that long, I came up with
original code: 320 ms
array version: 21 ms
put empty into vCombined
put fld "A" into v1
It's probably a lot of text. The engine has to start from the beginning of
every string then scan through for every cr or lf or cr/lf or whatever counts
as a line break, until if finds the nth one. The more lines, the longer the
scan takes each time, and the more text per line the exponentially
On 8/19/22 15:07, Bob Sneidar via use-livecode wrote:
Off the top of my head:
split v1 by tab
split v2 by tab
split v3 by tab
split v4 by tab
put the keys of v1 into tKeyList
sort tKeyList ascending numeric
repeat for each line tKey in tKeyList
put tKey & tab & v1 [tKey] & tab & v2 [tKey]
Based on what Bob said, here is my version of that handler:
on mouseUp
local tA, tB, tC, tD, tAll, tStart, tEnd
put fld "A" into tA
put fld "B" into tB
put fld "C" into tC
put fld "D" into tD
--
put the milliseconds into tStart
split tA by cr
split tB by cr
split tC
First optimization would be to put … & cr after vCombined and then delete the
trailing from when done.
Sent from my iPhone
> On Aug 19, 2022, at 5:11 PM, Paul Dupuis via use-livecode
> wrote:
>
> I have a set of fields, call them A, B, C, and D. Each has the same number
> of lines. Each
Off the top of my head:
split v1 by tab
split v2 by tab
split v3 by tab
split v4 by tab
put the keys of v1 into tKeyList
sort tKeyList ascending numeric
repeat for each line tKey in tKeyList
put tKey & tab & v1 [tKey] & tab & v2 [tKey] & tab & v3 [tKey] & tab & v4
[tKey] & cr after
I have a set of fields, call them A, B, C, and D. Each has the same
number of lines. Each field has different text (per line)
I need to combine the data - frequently - into a form that look like:
C>
For the number of lines in the set of fields. Currently I do this as
follows:
put empty
17 matches
Mail list logo