Faster List.foldr and List.map

564 views
Skip to first unread message

Ilias Van Peer

unread,
Sep 26, 2017, 9:54:21 AM9/26/17
to elm-dev
Hi,

Inspired by a tweet about faster List.map for ocaml, I started experimenting and it turns out that writing implementations for `map` and `foldr` in pure Elm - which outperform both the current implementation as well as Robin's 0.19 implementation - is possible in a stack-safe manner.

More info, a bunch of charts and a gazillion benchmarks: https://github.com/zwilias/elm-faster-map

I've asked a few people for feedback in private, but at this point I feel confident enough about the results to ask the wider community for feedback. So please, check it out, see if you can find issues with the implementation or the theory.

Would there be any interest in a PR to implement this in elm-lang/core?

Feel free to contact me on Slack to talk things through.

Kind regards,

Ilias

Evan Czaplicki

unread,
Oct 17, 2017, 4:14:31 PM10/17/17
to elm-dev
Very cool! I saw that blog post as well and was curious how it would work.

My main question is about how big the code is. I have been working a ton on getting asset sizes to be super tiny, and I think it's valuable to evaluate performance alongside the distribution cost.

I'm not sure it'll be easy to evaluate that until there is a 0.19 alpha to try out, but once we can put some numbers on both halves of this, I think it'll be way easier to make a call on this.

Great work!
Evan

--
You received this message because you are subscribed to the Google Groups "elm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elm-dev/85c74830-f79f-4415-bd6f-7355e77355dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages