Open
Description
Currently, we eagerly capture all entry locations in the index. We may be able to improve both performance and memory usage if we delay that to only when entries are interacted with.
Entries already know which file they were discovered in and we already fetch their comments lazily, so we could very well build the indexer locations lazily too. Something like
class Entry
def comments
return @comments if @comments
fetch_lazy_data!
@comments
end
def location
return @location if @location
fetch_lazy_data!
@location
end
private
def fetch_lazy_data!
parse_result = Prism.parse_file(@file_path)
# Figure out the location for this entry
# Figure out comments
# Other things we fetch lazily
end
end