I have struggled multiple times with the inability to send elm/bytes over ports in Elm.
Searching for solutions I have seen multiple ways to do it, each suboptimal in their own way.
Recently I wondered which method is the most performant and created GitHub - anmolitor/elm-bytes-ports-benchmark: Compares a the different available hacks to get bytes from JS into Elm and vice versa.
Before you click the link:
- What methods do you know currently?
- Which one do you expect to perform the best for small amounts of Bytes?
- Which one do you expect to perform the best for large amounts of Bytes?
I was surprised how well a HTTP approach via patching the XMLHttpRequest prototype
performed. I expected it to do well, but only for large sizes. Apparently the overhead of creating a request/response object is lower than I thought.
What do you think about the method used for benchmarking? Are there any potential ways that I missed?
Thanks for reading and lets hope that in the Future there is a standard way for passing Bytes between the languages without overhead.