The same thing that Google can search in billions of records, or a text indexing system, such as Lucene , is running. These systems first index the text to search, and it can be quite long; you can see it when you first import a project into Eclipse, in order to index everything, it takes a lot of time in the background.
Once the data is indexed, it can be searched with incredible speed. I believe that the complexity of such a search is O (log n), that is, it takes 1 unit of time to search among 10 items, 2 for 100 items, 3 for 1000 items, 6 per million, 9 per one billion, etc. .
For such an efficient algorithm, the data size is of little importance.
source share