microsoft / microsoft/vscode-cpptools

Slow Autocomplete for translation units including bulky header files

Open
#3,907 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service performance
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: LanguageService

Describe the bug

  • OS and Version: macOS Mojave (10.14.5), MBP Mid 2015
  • VS Code Version: 1.36.0
  • C/C++ Extension Version: 0.24.0
  • Other extensions you installed (and if the issue persists after disabling them): CMake Tools, Git lens
  • Autocompletion for source files including bulky header files like the ones given below. Auto complete sometimes takes 5 seconds to return result. Most of the time it steadily takes 2-3 seconds to return results.
    Tried disabling/enabling IntelliSense cache yet 4-5 seconds lag was visible.

To Reproduce
Source Sample:

#include <algorithm>
#include <atomic>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <random>
#include <thread>
#include <vector>

#include <boost/intrusive/list.hpp>
#include <boost/lockfree/queue.hpp>
#include <boost/program_options.hpp>

Preprocessed file has 1.3 lakh lines (4.4 MB).
c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "${vcpkgRoot}/x64-osx/include"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "configurationProvider": "vector-of-bool.cmake-tools",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}

Expected behavior
Autocompletion returning results within a second always (too much to ask for?).

Screenshots
Instead autocomplete taking 5 seconds to complete
Autocomplete

Profiler Output
Just in case, if you may require, I've attached Instruments profile output of server for autocomplete operation.
Run 1 -> IntelliSense caching disabled.
Cache Enabled

Run 2 -> IntelliSense caching enabled.
Cache Enabled

Complete Browsable Instruments Trace:
Msvc.Autocomplete.trace.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C++ source sample, c_cpp_properties.json, and the attached Msvc.Autocomplete.trace.zip profiler output. Reproduce autocomplete on the listed standard and Boost headers, then compare the observed 2–5 second latency with the expected response within one second.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
developer-experience, performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.