resyntax icon indicating copy to clipboard operation
resyntax copied to clipboard

Add load tests for expansion analyzers

Open Copilot opened this issue 3 months ago • 1 comments

Expansion analyzers can take excessive time on large files. This adds load tests to catch performance regressions.

Changes

  • test/analyzer-load-test.rkt: Load tests for all four expansion analyzers (identifier-usage, variable-mutability, ignored-result-values, function-expression)
    • Generates ~300 line test program with functions, variables, mutations, and nested expressions
    • Uses expansion-analyze directly with time-apply to measure actual analyzer performance
    • Pre-expands syntax once using source-expand and reuses it for all tests
    • Verifies each analyzer completes within 30 second timeout
    • All tests are in a (module+ test ...) submodule

Each test measures elapsed time and fails with diagnostic message if timeout exceeded:

(test-case "identifier-usage-analyzer load test"
  (define-values (result cpu-time real-time gc-time)
    (time-apply expansion-analyze (list identifier-usage-analyzer expanded-syntax)))
  
  (check-true (< real-time timeout-ms)
              (format "identifier-usage-analyzer took ~a ms, expected < ~a ms"
                      real-time timeout-ms)))
  • Fixes jackfirth/resyntax#734
Original prompt

This section details on the original issue you should resolve

<issue_title>Analyzer load tests</issue_title> <issue_description>Expansion analyzers can easily take much longer than expected on large files. There should be a load test for each analyzer that asserts that the analyzer is capable of analyzing a suitably large file within a reasonable amount of time. This should use the analyzer timeout configuration option mentioned in jackfirth/resyntax#733.</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes jackfirth/resyntax#734

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot avatar Nov 13 '25 17:11 Copilot