Can we improve bounds checks for splitAt?
Open
performance
Seq
- Dominant language
- Haskell
- Stars
- 355
- Forks
- 194
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 4
Description
Currently, we check whether the split point is within the sequence, and, if so, call `splitTreeE` to handle it. That doesn't seem to make a lot of logical sense, because checking that requires pattern matching on the tree, and then `splitTreeE` immediately matches on it again. I tried moving the bounds check into the `splitTreeE` cases, and that was bad. It seems that doing so confused the inliner or something, and stuff got slower. The Core looked weird, with a case-of-case join point that ignored its `Int` argument. Inlining `splitMiddleE` helped some things, but made others worse. I'd like to see a non-fragile solution.
Contributor guide
Assessment
This issue has not been assessed yet.