Skip to content

C import builds macro value tables with quadratic prefix copies, stalling Windows package checks #1163

Closed

Description

@ehartford

Floating bzip2 and libcurl UATs time out inside C import on both native Windows architectures. Native dumps now identify an expensive common path rather than a linker or child-process wait.

Evidence: https://github.com/withlang-dev/with/actions/runs/35197408709 uses the exact compiler and symbols from run 35169665692. The final x86_64 dumps for both packages and the arm64 bzip2 dump stop in rt_memcpy in str_concat_n_copy, called by ci_collect_object_macro_values.

At the libcurl x86_64 collector frame, rbp=0x3c9d is the current index (15517) and rbx=0x8257 is the macro count (33367). The call at helper +607 invokes with_str_concat_n with five parts. The first part is the entire existing string, length 0x8dc54, and the other four append a delimiter, name, delimiter, and value. The next instructions replace and free the old string. This is the exact values = values ++ "|" ++ name ++ "=" ++ value line in src/CImport.w (currently 2763). Repeated full-prefix copies make table construction quadratic.

A reduced import containing only internal integer object macros plus one public ANSWER reproduces the scaling on Darwin under a forced cold cache: frontend.c_import takes 226.480 ms at 1000 macros, 3389.432 ms at 8000, and 45990.103 ms at 33000. The generator and logs are under out/with-get-investigation/generate_macro_scaling.w and macro_scale_*-baseline.log.

Expected: the available surface promised by specification §16.2 and the handoff's explicit floating-package ruling remains practical for ordinary platform headers. Preserve every macro and its diagnostics; do not filter away the header surface or raise the UAT timeout. Use the existing amortized append facility for table construction and inspect the rest of the macro pipeline for the same cost pattern. The captures so far identify an expensive region; verification must still show that fixing it resolves the complete package timeout.

Activity

  1. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce in source; 667c6d1 (#1191) rewrote ci_collect_object_macro_values (src/CImport.w:3528) to insert each macro into a HashMap[str, str], with no accumulated string to copy.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions