Skip to content

First query in a process takes 9 ms to compile, half of it building ANTLR character sets #1301

Open

Description

@zahariash

This work was produced with the help of language models.

The first query in a process spends about half of its compile time deserializing the lexer's ATN: RETURN 1 compiles in 9.4 ms the first time and in under 0.1 ms afterwards (the 0.18 ms in #1290 is a later query). The vendored ANTLR runtime's IntervalSet::add walks the whole interval list for every interval it adds, and the lexer's Unicode character sets are built one sorted interval at a time, so building a large set is quadratic in its number of intervals.

Expected: building a set from sorted, non-touching intervals is linear in its size. Actual: each added interval scans every interval already in the set.

Part of #1290. Fix in #1302.

Activity

  1. zahariash commented on Oct 18, 2026

    @zahariash
    ContributorAuthor

    I can't add sub-issues on this repository; could you set this issue's parent to #1290?

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