diff --git a/src/clang_translation_unit.cc b/src/clang_translation_unit.cc index 39f84ae5..ff9ddb9c 100644 --- a/src/clang_translation_unit.cc +++ b/src/clang_translation_unit.cc @@ -17,8 +17,12 @@ namespace { // We need to serialize requests to clang_parseTranslationUnit2FullArgv and // clang_reparseTranslationUnit. See // https://github.com/jacobdufault/cquery/issues/43#issuecomment-347614504. -std::mutex g_parse_translation_unit_mutex; -std::mutex g_reparse_translation_unit_mutex; +// +// NOTE: This is disabled because it effectively serializes indexing, as a huge +// chunk of indexing time is spent inside of these functions. +// +// std::mutex g_parse_translation_unit_mutex; +// std::mutex g_reparse_translation_unit_mutex; void EmitDiagnostics(std::string path, CXTranslationUnit tu) { std::string output = "Fatal errors while trying to parse " + path + "\n"; @@ -86,7 +90,7 @@ std::unique_ptr ClangTranslationUnit::Create( CXTranslationUnit cx_tu; CXErrorCode error_code; { - std::lock_guard lock(g_parse_translation_unit_mutex); + // std::lock_guard lock(g_parse_translation_unit_mutex); error_code = clang_parseTranslationUnit2FullArgv( index->cx_index, filepath.c_str(), args.data(), (int)args.size(), unsaved_files.data(), (unsigned)unsaved_files.size(), flags, &cx_tu); @@ -125,7 +129,7 @@ std::unique_ptr ClangTranslationUnit::Reparse( std::vector& unsaved) { int error_code; { - std::lock_guard lock(g_reparse_translation_unit_mutex); + // std::lock_guard lock(g_reparse_translation_unit_mutex); error_code = clang_reparseTranslationUnit( tu->cx_tu, (unsigned)unsaved.size(), unsaved.data(), clang_defaultReparseOptions(tu->cx_tu));