Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Compile-Time/Perf: heavy rfl instantiation on LspTypes.h forces PCH, /bigobj, and prompts raw-string escape hatch TODO #185

Backlog

Description

@clockblocker

Part of #138
Popularity: 1/7 corpus consumers (slang-server)

Related issues

Observed Downstream Workarounds (hudson-trading/slang-server @ 1b413a46)

slang-server models the full LSP 3.17/3.18 wire surface (~7,000 lines of structs, std::optional, rfl::Variant, rfl::Literal, rfl::Box) in include/lsp/LspTypes.h (which includes <rfl/json.hpp>) and instantiates rfl::from_generic / rfl::to_generic across dozens of registered LSP handlers inside SlangServer::getInitialize:

  1. Mandatory precompiled header around LspTypes.h (CMakeLists.txt#L381-L382):
    target_precompile_headers(slang_server_obj_lib PRIVATE
                              "${PROJECT_SOURCE_DIR}/include/lsp/LspTypes.h")
  2. Explicit MSVC /bigobj flag (CMakeLists.txt#L120-L123):
    if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
      add_compile_options(/utf-8 /bigobj /permissive-)
      add_compile_options(/Zc:preprocessor)
    endif()
  3. Explicit compile-time pain TODO in SlangServer::getInitialize (src/SlangServer.cpp#L61-L62):
    lsp::InitializeResult SlangServer::getInitialize(const lsp::InitializeParams& params) {
        // TODO: may want to use raw strings here bc all these types make compile time longer

Root Cause & Suggested Direction

Deeply nested protocol structs containing many std::optional, rfl::Variant, and rfl::Description fields trigger heavy template instantiation and large object files when parsed/serialized in a single translation unit.

Continue the compile-time & object-size reduction track in #85 / #90 / #91 (reducing template instantiation depth for Variant / optional / Generic / to_named_tuple, and supporting explicit out-of-line parser/writer instantiation or compile-time isolation for large schema headers).

Upstream Overlap

Activity

  1. added
    known-downstream-workarounds
    on Nov 29, 2026
  2. changed the title [-]Compile-Time/Perf (slang-server): heavy rfl instantiation on LspTypes.h forces PCH, /bigobj, and prompts raw-string escape hatch TODO[/-] [+]Compile-Time/Perf: heavy rfl instantiation on LspTypes.h forces PCH, /bigobj, and prompts raw-string escape hatch TODO[/+] on Nov 29, 2026
  3. clockblocker commented on Nov 29, 2026

    @clockblocker
    OwnerAuthor

    Tracking & PR Cross-Reference

    Status: Partially addressed by Wave 1 compile-time / object-size PRs in upstream-queue (Draft PR #191); deeper core rewrite parked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    known-downstream-workarounds

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions