microsoft / microsoft/vscode-cpptools

Slow Autocomplete for translation units including bulky header files

未关闭
#3,907 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug Language Service performance
主要语言
TypeScript
星标
6.2k
派生
1.7k
平均合并
14 小时 46 分钟
30 天内合并 PR
61

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 C++ 源代码示例、c_cpp_properties.json 以及附加的分析器输出 Msvc.Autocomplete.trace.zip 开始。在列出的标准头文件和 Boost 头文件上重现自动补全,然后将观察到的 2–5 秒延迟与预期在一秒内的响应进行比较。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp, vscode
领域
developer-experience, performance, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。