haskell / haskell/bytestring

Some ineffective INLINE pragmas on recursive definitions in bytestring.

Open
#522 2 comments 0 reactions 0 assignees View on GitHub
pr-welcome
Dominant language
Haskell
Stars
301
Forks
144
Avg merge
7d 22h
Merged PRs (30d)
1

Description

Compiling GHC with lint revealed some ineffective INLINE pragmas in bytestring.

In particular in Data/ByteString/Lazy.hs:

* compareLength
* packZipWith
* foldr'

For foldr' it probably doesn't matter.

But for packZipWith and compareLength splitting the recursive part of the function into a local recursive definition would allow the non-recursive part to inline and allow those functions to optimize better when applied to statically known empty chunks.

NB: They are ineffective as GHC will never inline self-recursive functions.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in Data/ByteString/Lazy.hs with compareLength, packZipWith, and foldr'. Review how their recursive definitions interact with the INLINE pragmas and GHC's treatment of self-recursive functions. Done means the ineffective pragmas are addressed and the non-recursive portions of compareLength and packZipWith can optimize for statically known empty chunks.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.