Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SET (Steve's Extended Toolset)
#7
Be aware that the following is very slow with >10000 lines:

Code: (Select All)
Open "word lists\370099 Word List.txt" For Binary As #1
Print "Attempting to load 370,099 words into memory..."
Do Until EOF(1)
    Line Input #1, Words(count)
    count = count + 1
Loop

For 370099 lines, the following is over 100x faster:
Code: (Select All)
t$ = _ReadFile$(" word lists\370099 Word List.txt")
p0& = 1: p& = InStr(t$, Chr$(13))
Do While p& > 0
  Words(count) = Mid$(t$, p0&, p& - p0&)
  count = count + 1
  p0& = p& + 2: p& = InStr(p0&, t$, Chr$(13))
Loop
Words(count) = Mid$(t$, p0&)

For larger files this differences is even bigger
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
Reply


Messages In This Thread
SET (Steve's Extended Toolset) - by SMcNeill - 04-17-2022, 09:42 PM
RE: SET (Steve's Extended Toolset) - by madscijr - 05-10-2022, 02:26 PM
RE: SET (Steve's Extended Toolset) - by SMcNeill - 05-10-2022, 02:46 PM
RE: SET (Steve's Extended Toolset) - by SMcNeill - 05-12-2022, 12:51 PM
RE: SET (Steve's Extended Toolset) - by SMcNeill - 05-12-2022, 01:34 PM
RE: SET (Steve's Extended Toolset) - by Dragoncat - 03-31-2025, 06:49 PM
RE: SET (Steve's Extended Toolset) - by mdijkens - 04-01-2025, 09:30 AM



Users browsing this thread: 1 Guest(s)