Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Eclipse execute such a fast search for hits to a phrase/regexp

Eclipse searches across a large project for all matches to a phrase (even a regexp phrase) surprisingly fast.

Do they use java.util.regex internally?
I assume that they do not index with a search engine, because their searches are too slow for that, yet there is some delay the very first time you do a search after launching eclipse.

like image 486
Andy Nuss Avatar asked Sep 02 '12 04:09

Andy Nuss


People also ask

How to use quick text search in Eclipse?

Open with Cmd-Shift-L, type your search and see results immediately. Please note: As of Eclipse 2019-09, the Quick Text Search got contributed to the Eclipse platform project, so no need to install it as a separate feature anymore. Every single Eclipse user on the planet can enjoy this feature now out-of-the-box.

Can you use quick search in Eclipse without spring?

Even if you are not a Spring or Grails developer, you might be interested in this Feature because it can also be installed separately into a vanilla Eclipse. The Quick Search dialog is designed to do just one thing and do it well: use simple text searches to quickly navigate around your workspace.

How do I search for files in Eclipse without telling them?

If you want to search for anything without telling Eclipse what it is, use ctrl+shift+L (QuickEclipseSearch). This is the quickest way. You can also use 'file search' (press ctrl+H) and navigate into file search using left and right arrrows on the top right corner of your windows. Or type 'file search' in the 'Quick Access' window.

How do I install the Eclipse quick search plugin?

The eclipse quick search plugin is part of Spring Tools Suite (STS). SO if you have STS installed in eclipse, then chances are you have it already. To Install eclipse quick search, goto STS release for eclipse version you have. A quick google search can direct you there. e.g.


1 Answers

Eclipse Helios (3.6) includes an improved version of Eclipse PDT, labeled 2.2. It is also included in the current Zend Studio (7.1 and above). Among other enhancements, it dramatically improved the performance of code lookup-related tasks like searching references, creating a type hierarchy and even code completion. This is due to a new design, inspired by nWire, which uses the h2 database engine as a persistent storage for this data.

The h2 database is a high-performance, low profile, Java native database engine, created as a successor to the widely used HSQLDB. It is open source and free to use. nWire uses h2 since its' early days.

Source: http://www.nwiresoftware.com/blogs/nwire/2010/09/five-tips-speeding-eclipse-pdt-and-nwire

In short, it looks like you're seeing these improvements because Eclipse utilizes the h2 database engine.

Then, if you dig a little deeper, here's a quick sampling if the H2 source code; it does indeed look like they're leveraging java.util.regex:

20 import java.util.regex.Matcher;
21 import java.util.regex.Pattern;
like image 119
brandonscript Avatar answered Sep 27 '22 18:09

brandonscript