Shared Indexes Plugin Unveiled
Indexing is one of the key features under the hood of IntelliJ IDEA. It is designed to simplify your work by teaching the IDE the ins and outs of your code even before you start applying any changes. The IDE indexes classes, methods, and other code elements to create a virtual map of your project.
At JetBrains, we believe that the time you spend indexing at startup will save you precious hours when you are busy coding and want nothing to disturb your creative flow. It’s better to have your project fully indexed before you need contextual help with code completion, or have to navigate somewhere deep in the code.
When you step into the realm of large projects, the only concern that you may have about indexing is speed. You may sometimes wonder, “If someone else has already indexed the project, why do I need to index it too?” And we’d say that’s a valid question.
We’ve addressed this concern with the Shared Indexes Plugin, which allows you to download indexes prepared on another machine instead of building them locally. You can generate shared indexes on one computer and download them to another, just bear in mind that they should all be running the same OS. If your network connection is sufficiently fast, this plugin can reduce the overall indexing time for a Java project by up to 75%.
How does it work?
We build shared indexes in a way that lets them work on multiple computers. Ordinary indexes depend on file IDs inside file systems that are unique to each local computer. They are additionally affected by the IDE configurations. Shared indexes, by contrast, use hashes of file contents (with mixins included). This allows them to be used outside the environment they were created in.
You can easily try this plugin out by downloading pre-built shared indexes for JDKs that are available from right inside IntelliJ IDEA. If we detect that the CDN contains a shared index for the selected JDK, the IDE will ask you if you want to download it. You can choose to download the index just once or configure the system to download shared indexes automatically.
You can access the settings from the pop-up window you can see in the screenshot above or via Preferences/Settings/Tools/Shared Indexes.
If you need custom shared indexes for your private project, you will have to generate and distribute them to the target IDE build. For more information on how to do this, please refer to our guide.
We ran some tests with large companies working on large projects, and we have already seen that the time lost to indexing has decreased considerably.
If you want to play a role in making IntelliJ IDEA better, give our Shared Indexes plugin a try, and be sure to send us your feedback.
Starting from v.2020.2, the Shared Indexes plugin will be available for download for IntelliJ IDEA Community Edition, IntelliJ IDEA Ultimate, GoLand, PhpStorm, PyCharm, RubyMine, and WebStorm.