google / google/xls

Avoid importers of a DSLX module paying a heavy type inference cost for its tests.

Open
#3,886 1 comment 0 reactions 1 assignee Claimed by @richmckeever View on GitHub
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

If a test function does something like:

`assert_eq(0xffffffff,` sizeof(uN[0xffffffff]:0));`

Importers of the module pay the significant time and memory cost of producing the gigantic Bits object for the constant. For example, std.x wants to be doing this in 2 of its tests. If we uncomment those, the type inference time of the whole module (in the context of an importer) doubles, and some random DSLX targets run out of memory.

We should probably just ignore test functions of imported modules in type inference, but without compensating changes, we might then have lower coverage for the stdlib in C++ type inference unit tests.

Another mitigation for this type of scenario would be to have a sparse or lazy representation of large constants.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.