elmcraft / core-extra

Utility functions for an improved experience with elm/core
https://package.elm-lang.org/packages/elmcraft/core-extra/latest/
Other
23 stars 11 forks source link

Adds a slightly nicer setup for benchmarking #13

Closed gampleman closed 1 year ago

gampleman commented 1 year ago

I started looking into making some of the List.Extra functions tail recursive. I wanted to see what impact it has on performance:

Benchmark results showing tail recursive functions being about 15% slower for unfolds and uniquePairs

In order to do this, I jazzed up the package.json scripts so that you can run npm run start:bench and you should get the benchmarks to appear on your screen running. A fun project would be to make an actual CLI runner, but one step at a time :shrug:.

If you have time, I'd appreciate some code review (cc @miniBill and @ahankinson).

ahankinson commented 1 year ago

Am I right in thinking that this structure will only be temporary? That eventually one or the other version will be chosen and implemented? If so, I would not actually commit the changes to the List/Extra module versions in the module itself until one is chosen.

Perhaps a benchmarks/src/List/Extra/*.elm structure would be useful to capture the testing phases? I see there's already a similar structure for Array.Extra

gampleman commented 1 year ago

@ahankinson I'm slightly confused. Isn't that what's in this PR? All of the implementations being evaluated are in benchmarks/src/List/Extra/* (even though at the moment some of them are duplicates of what's in List.Extra.

ahankinson commented 1 year ago

You are right, my mistake! I didn't see that the folder was indented on the left. I'm sorry.