I like your solution. But i just wanted to see how Claude.ai solves our issue.
BTW: If i + 1 > lines.LastIndex Then Exit will be triggered only 4 million times in our case.
BTW2: Thereās plenty of room for optimization. For example:
This can be replaced by putting lines.LastIndex into a variable before entering the loop and doing the lines.LastIndex over and over again.
And instead of doing the lineValue = lines(i + 1) for a 4 million times, we could use the lines(i + 1) direct within the Select Case ... End Select Section.
This should be checked. I remember being told by a Xojo engineer years and years ago that the end value in a Forā¦Next loop was only accessed once, right when the loop begins. Perhaps things have changed, it really was a long time ago.
No, because LineValue is used in subsequent calculations, it is more efficient keep the code as-is.
Yeah, I noticed that too. I reported the numbers figuring that they would be useful relative benchmarks, even if only for my own testing. All values are from plain debug sessions.
Iām on a 2019 MacBook Pro, 2.3Ghz i9 processor. So getting on the older side⦠I keep it because I need to virtualize x86 Windows (I canāt use ARM Windows for software reasons). I have some hardware and performance suspicions about this laptop, I really should wipe it and rebuild.
Itās hard to say without seeing a lot more of your code, but if currently have many places that are reading the file as youāve shown (read an indicator line, read a value line) thatās going to be pretty inefficient code to maintain. I would suggest you look at reading all the data in at once, using the ToArray functionality, and then pass the array around to the various bits that do the processing. That way youāll get the speed advantages of a single read and simplify your code overall.
If you like, upload your project and weāll look at it. I have a hunch I know what it looks like.
OK! If itās easy to do, you could also replace your Selectā¦Case statement with If..ElseIf. This made a significant difference in the speed of my code and is easy to implement.
I tried to replace Select Case with If elseIf not in all methods but only in which are called when reading the file with 8000000 lines because this file contains only DXF line objects.