Why does lazy list foldr reverse into a temporary lazy list?
FranklinChen opened this issue · 1 comments
FranklinChen commented
I get why https://github.com/purescript/purescript-lists/blob/v6.0.0/src/Data/List/Lazy/Types.purs#L121 does what it does with reverse, but it seems to me there is no reason to create a brand new temporary lazy list just to consume it left to right. How about pushing elements left to right into a temporary JavaScript array and then going right to left in that?
milesfrain commented
No objections to optimizing by using a temporary JS array.
I think the existing version was chosen just to keep the code concise at the cost of performance.
Another issue discussing improving reverse performance is #185