Opened 3 years ago

Last modified 3 years ago

#13351 patch task

Investigate a foldr rule for short static lists

Reported by: nomeata Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D3246
Wiki Page:

Description

GHC.Base says:

-- The foldr/cons rule looks nice, but it can give disastrously
-- bloated code when commpiling
--      array (a,b) [(1,2), (2,2), (3,2), ...very long list... ]
-- i.e. when there are very very long literal lists
-- So I've disabled it for now. We could have special cases
-- for short lists, I suppose.
-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs)

"foldr/single"  forall k z x. foldr k z [x] = k x z
"foldr/nil"     forall k z.   foldr k z []  = z

I wonder if we should extend the list of rules at the bottom to a few more list lengths, as the comment suggests.

Change History (1)

comment:1 Changed 3 years ago by nomeata

Differential Rev(s): Phab:D3246
Status: newpatch

Patch for review at Phab:D3246

Note: See TracTickets for help on using tickets.