I see that I am more than a decade late and perhaps both livecode and my computer are much faster but my solution takes < 1 second and I haven't optimised it.
Solution:
Build the data with the format
title (key is the word "education" or not in that title
name
phone num
fax num
Then I loop through the data.
If line 1 does not include the word education, delete lines 1 to 4 of the data
if line 1 DOES contain the word education then store line 2 (name) & line 4 (giving name and fax number)
delete line 1 to 4 of the data -- get next set
and repeat
I was going to try to do something clever but this suffices I think. 1 second is surely not too slow for this sort of problem.
So, am I brilliant (possible but less probable explanation) or has LC and our computers made a combined 900x or 300x or 100x increase in performance since this problem was submitted? I work on an m1 mini with LC 10.something.
I know people sometimes say LC is slow and maybe it is compared to some other languages but I generally find that it is almost insanely fast. I have a lot of functions in an app I am writing where time is not critical but speed is always nice. A little clever rewriting brought them down typically from 125 milliseconds per function to 1 or less than 1 millisecond. No code utility was lost and actually my code is simpler and clearer than the more complex stuff before.
Solution:
Build the data with the format
title (key is the word "education" or not in that title
name
phone num
fax num
Then I loop through the data.
If line 1 does not include the word education, delete lines 1 to 4 of the data
if line 1 DOES contain the word education then store line 2 (name) & line 4 (giving name and fax number)
delete line 1 to 4 of the data -- get next set
and repeat
I was going to try to do something clever but this suffices I think. 1 second is surely not too slow for this sort of problem.
So, am I brilliant (possible but less probable explanation) or has LC and our computers made a combined 900x or 300x or 100x increase in performance since this problem was submitted? I work on an m1 mini with LC 10.something.
I know people sometimes say LC is slow and maybe it is compared to some other languages but I generally find that it is almost insanely fast. I have a lot of functions in an app I am writing where time is not critical but speed is always nice. A little clever rewriting brought them down typically from 125 milliseconds per function to 1 or less than 1 millisecond. No code utility was lost and actually my code is simpler and clearer than the more complex stuff before.
Statistics: Posted by bbalmerTotalFluency — Wed Jun 12, 2024 7:35 am