Stack safe State

46 views
Skip to first unread message

Roy Brokvam (mrbackend)

unread,
Mar 4, 2016, 10:54:00 AM3/4/16
to Functional Java
Hi, I've made a stack safe State that uses fj.control.Trampoline. I needed this to do some property testing on large data structures, for which the current State class would stack overflow. So, it seems to me that a stack safe version would a useful addition in functionaljava.

Q1: Should it replace the existing State (it has the exact same "interface"), or be added as a separate class? Preliminary benchmarking suggests that the stack safe version has a ~15% execution time penalty, compared to the current State class.

Q2: If it should be added as a separate class, should it be named TrampolineState, StackSafeState or what else?

Regards,

jbgir...@gmail.com

unread,
May 9, 2016, 3:23:15 PM5/9/16
to functio...@googlegroups.com
Hi,

I think stack-safety should be a priority so +1 for replacing existing implementation.


cheers,
Jb

--
You received this message because you are subscribed to the Google Groups "Functional Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to functionaljav...@googlegroups.com.
To post to this group, send email to functio...@googlegroups.com.
Visit this group at https://groups.google.com/group/functionaljava.
For more options, visit https://groups.google.com/d/optout.

Mark Perry

unread,
May 24, 2016, 9:37:57 AM5/24/16
to Functional Java

We should generally replace it, although there are a few classes that have duplicate methods based on stack space consumed.  Stream.foldRight1 is one that I found in my brief look.

Is there a GitHub issue for this?


Roy Brokvam (mrbackend)

unread,
May 30, 2016, 5:28:59 AM5/30/16
to Functional Java
I'll make one, just wanted to check the alternatives first :)
Reply all
Reply to author
Forward
0 new messages