perf: Subtype checking should not perform quadratic traversal
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 301
- Forks
- 85
- Avg merge
- 1h 4m
- Merged PRs (30d)
- 4
Description
The equality check performed at the beginning of subtype checking: https://github.com/dfinity/candid/blob/30c388671462aecdc4a3a9753d50dc2e8208c200/rust/candid/src/types/subtype.rs#L39-L41
should only do a cheap check for "physical" equality (using ptr_eq on anything non-primitive).
Otherwise we do full traversals of complex nested types at every level (quadratic).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read rust/candid/src/types/subtype.rs around lines 39–41 and trace the equality check at the start of subtype checking. Confirm that non-primitive types use a physical ptr_eq check rather than repeatedly traversing nested types, while preserving the existing subtype behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100