struct Location size
Walter Bright
newshound2 at digitalmars.com
Tue May 9 03:36:46 UTC 2023
On 5/8/2023 5:32 PM, Adam D Ruppe wrote:
> I wouldn't separate out column/line/file at all. Concatenate all the files
> together in memory and store only an offset into that gigantic array. If an
> error happens, then and only then go back to extract the details by slicing the
> filename out of a listing and rescanning it to determine line and column. (You'd
> probably have an index that does a bit of both, like every new file or every
> 5000 lines, add an entry to the lookup table. Then when you do hit an error, you
> just need to scan from the closest point forward instead of the whole thing.)
>
> If there's no errors, it uses little memory and is fast. If there is an error,
> the rescanning time is not significant anyway relative to the time to fix the
> error.
That is indeed a clever idea, thank you.
More information about the Digitalmars-d
mailing list