Skip to content

fn benchmarks#1

Merged
mariomac merged 2 commits into
mariomac:mainfrom
kamstrup:main
Dec 4, 2022
Merged

fn benchmarks#1
mariomac merged 2 commits into
mariomac:mainfrom
kamstrup:main

Conversation

@kamstrup
Copy link
Copy Markdown
Contributor

@kamstrup kamstrup commented Dec 4, 2022

Hi, great work on the benchmarks! <3 I added a benchmark with my own functional Go lib "fn".

Results:

$ go test ./... -bench . -benchmem -count 10 > f.txt
$ benchstat f.txt
name        time/op
Baseline-8   531µs ±37%
Mariomac-8   521µs ±29%
Lambda-8     660µs ±34%
Goio-8      1.67ms ±11%
Automi-8     772µs ±19%
Fn-8         496µs ± 7%

name        alloc/op
Baseline-8   199kB ± 0%
Mariomac-8   192kB ± 0%
Lambda-8     243kB ± 0%
Goio-8       591kB ± 0%
Automi-8     314kB ± 0%
Fn-8         192kB ± 0%

name        allocs/op
Baseline-8   2.56k ± 0%
Mariomac-8   2.57k ± 0%
Lambda-8     3.81k ± 0%
Goio-8       14.3k ± 0%
Automi-8     4.67k ± 0%
Fn-8         2.57k ± 0%

Memory is indentical, but I beat you by a smidgen on speed ;-P

Did a quick look through your code. Nice work! I think the primary difference between our approaches is that you seem closer to Java Streams, and I am a bit closer to Clojure. Fx. my Seq API is designed to work on "immutable sequences", ie you get a head+tail back when you walk a Seq, and the underlying Seq is stateless. Whereas your stream lib keeps a stateful iterator.

Copy link
Copy Markdown
Owner

@mariomac mariomac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Thanks for your contribution

@mariomac mariomac merged commit 48a23b7 into mariomac:main Dec 4, 2022
@mariomac
Copy link
Copy Markdown
Owner

mariomac commented Dec 5, 2022

Appended the results at the end of the article: https://macias.info/entry/202212020000_go_streams.md

@kamstrup
Copy link
Copy Markdown
Contributor Author

kamstrup commented Dec 5, 2022

Appended the results at the end of the article: https://macias.info/entry/202212020000_go_streams.md

Thanks again Mario <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants