Let's connect
Let's connect

98% reduction of IDE load times for C++ Integration in Bazel monorepos

10 minutes read

Our client, a leading global financial services provider, sought to enhance the efficiency of their developers and tools. They encountered significant challenges with C++ integration using CLion and VSCode within a Bazel monorepo environment.

These challenges resulted in slow tool performance, delays for developers, prolonged indexing times, and difficulties with code highlighting, navigation, and refactoring. To address these issues, VirtusLab implemented a series of targeted strategies. These improvements dramatically reduced the time required to generate compile commands to under a minute—a significant improvement from the previous duration of over an hour.

Download this success story as PDF

Print it out, take it with you to read later, or share it with your peers.Free download

The challenge

Our client’s initial development environment setup was fraught with inefficiencies significantly affecting development speed and productivity. The tools used by our client led to various challenges.

Struggles with CLion

  • Import limitations: CLion’s inability to import the entire repository at once hindered codebase-wide refactorings.
  • Performance issues: Developers faced slow indexing, refactorings, and generally low responsiveness.
  • Navigation and error detection: Inaccurate highlighting and inadequate code navigation for many use cases presented significant challenges in error detection and code usage tracking.

Issues with VS Code

  • Project import and indexing: VS Code provided better code highlighting but suffered from prolonged project import and indexing times.
  • Integration with Bazel: The integration with Bazel was slow and cumbersome, impacting workflow efficiency.

Configuration distribution difficulties

CLion and VS Code lacked an effective method for synchronizing or distributing optimal Integrated Development Environments (IDE) configurations among users, further complicating the development environment setup.

The solution

After thoroughly examining and familiarizing our client’s technology environment, VirtusLab implemented a series of targeted strategies to improve optimization and efficiency and address the challenges faced with CLion and VS Code.

Enhancements to VS Code

VirtusLab developed a custom tool for VS Code to generate compile commands and reduce generation time. To integrate this functionality into VS Code, we created a dedicated extension.

CLI tool

  • Reliable source/header file generation: Ensured accurate code highlighting by generating all necessary source and header files.
  • Performance optimization: Allowed deactivation of some source code generators to enhance overall performance.
  • Incremental synchronization: Offered faster feedback when modifying BUILD files through incremental synchronization.
  • Multi-repository support: Enabled managing multiple dependent Bazel repositories within a single workspace.

VS Code Extension

  • Development efficiency: Included a dedicated panel for frequent actions such as build, run, debug and project synchronization.
  • Instant indexing: Streamlined the process to connect with a remote indexing server. This provides immediate, full access to the project’s indexed data, enabling fast comprehensive code navigation and analysis.
  • Incremental indexing for local changes: Enabled incremental indexing to maintain accurate navigation and usage searches.
  • Contextual file inspection: Allowed quick viewing of header files in the context of various targets that use them.

Additional enhancements

  • Quality control: Integrated statistics and testing to monitor command quality and detect potential regressions, confirming most editor errors stem from incorrect build definitions.
  • Client-specific customization: Tailored the tool to meet specific client requirements, including custom Bazel build definitions.

Optimization of CLion

We turned to CLion and enhanced its efficiency.

  • Reduced the test indexing time by modifying the source code of CLion and the Bazel plugin.
  • Optimized project configurations, reducing project import and synchronization times.
  • Trained users on how to properly write project configurations.
  • Integrated support for reverse dependencies, crucial for finding usages or performing codebase-wide refactorings without full imports. It enhanced the reliability and efficiency of the development process. 

IDE Configuration efficiency

To bind it all together, we implemented a command-line tool to preconfigure CLion, IntelliJ, and VS Code. This ensured that developers could consistently and efficiently use their IDE setups automatically. 

The results

The implementation of our solution greatly enhanced developer experience, development efficiency and productivity, and resource management within our client’s development environment. In detail, the financial services provider saw several benefits.

  • Reduced project synchronization time in VS Code from over an hour to under a minute.
  • Increased speed of test indexing in CLion by 4 times.
  • Improved error detection accuracy and increased users' trust in their IDE.
  • Ensured the reliability of newly developed tools through robust testing and error reporting.
  • Enabled reliable refactoring and accurate symbol search, even across multiple repositories.
  • Added precise code highlighting, leading to improved productivity and decreased coding errors.
  • Enabled continuous refinement of the tools, leading to fewer disruptions and more stable development environments.
  • Elevated adoption of new tools and setup, resulting in positive feedback from developers.

Tech stack

Programming Languages: C++, Python, TypeScript

IDEs and Tools: Visual Studio Code, CLion, IntelliJ IDEA, clangd

Build Systems and Continuous Integration: Bazel, TeamCity

Take the first step to a sustained competitive edge for your business

Let's connect

VirtusLab's work has met the mark several times over, and their latest project is no exception. The team is efficient, hard-working, and trustworthy. Customers can expect a proactive team that drives results.

Stephen Rooke
Stephen RookeDirector of Software Development @ Extreme Reach

VirtusLab's engineers are truly Strapi extensions experts. Their knowledge and expertise in the area of Strapi plugins gave us the opportunity to lift our multi-brand CMS implementation to a different level.

facile logo
Leonardo PoddaEngineering Manager @ Facile.it

VirtusLab has been an incredible partner since the early development of Scala 3, essential to a mature and stable Scala 3 ecosystem.

Martin OderskyHead of Programming Research Group @ EPFL

The VirtusLab team's in-depth knowledge, understanding, and experience of technology have been invaluable to us in developing our product. The team is professional and delivers on time – we greatly appreciated this efficiency when working with them.

Michael GrantDirector of Development @ Cyber Sec Company