8

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.

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
Andy Nuss
  • 745
  • 1
  • 7
  • 20
  • I think they do use some indexer whose indexes are stored in .metadata/.plugins/org.eclipse.jdt.core – Vikdor Sep 02 '12 at 04:54
  • But the indexer wouldn't fare too well with general regex search, which also seems quite fast in eclipse. – Andy Nuss Sep 02 '12 at 05:09
  • 6
    eclipse 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. – Dinup Kandel Sep 02 '12 at 05:15
  • 2
    @DinupKandel you should convert that comment to an answer and provide sources ;) – brandonscript Jan 11 '14 at 04:01

1 Answers1

1

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 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;
brandonscript
  • 68,675
  • 32
  • 163
  • 220