Skip to content

Query inefficiency with a single-statement query with nested queries #581

@CatherineGasnier

Description

@CatherineGasnier

Copying a user report, which I could repro:

I want to run the following query to get some cxx variable declarations with empty string name

codemarkup.FileEntityLocations {file="fbcode/dead_code_removal/invariant_thrift/test/DataCollectorThriftInterceptorTest.cpp", entity={cxx={decl=DECL}}};

DECL = {variable={name={name=""}}};
DECL

This query takes forever and times out.

Changing the filtering to {variable={name={name=_}}} the 15 variables on that file immediately.

Trying a different string filter like {variable={name={name="test_info_"}}} also hangs.

But a more "normal" string like {variable={name={name="invariantFields"}}} finishes fast enough.

(End of user report)

The IR for the query is extremely and surprisingly complex, with ifs and choices, and the order of statements not what you'd expect.

This also takes a long time without the intermediate DECL:

codemarkup.FileEntityLocations {file="fbcode/dead_code_removal/invariant_thrift/test/DataCollectorThriftInterceptorTest.cpp", entity={cxx={decl={variable={name = {name=""}}}}}}

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