Clarification about linear effect performance #422
Replies: 4 comments
-
Okay, I think that I have a better benchmark setup which actually shows improvement, I'm going to revisit the other benchmarks.
|
Beta Was this translation helpful? Give feedback.
-
Results: (effect is the program directly above, effect_1 and effect_2 are the programs from the original post) Normalized relative to the program without linear annotation. Unoptimized:
Optimized with -O3:
|
Beta Was this translation helpful? Give feedback.
-
A version of the second one which is actually polymorphic:
Debug
Optimized:
|
Beta Was this translation helpful? Give feedback.
-
Changing the effects program to include more non-tail call operations causes a much clearer improvement.
|
Beta Was this translation helpful? Give feedback.
-
Can anyone point me to a particular pattern that would cause the performance to really change by adding a linear annotation? I think the monadic translation doesn't actually incur much overhead, and the information passed in the evidence passing about whether the function is tail resumptive is actually the thing that makes a big difference.
It seems that the linear annotation does not actually improve performance in general in my tests. I could be misunderstanding what kinds of patterns could cause the difference in performance to be noticeable though.
Using the
ctl
vsfun
keyword does improve performance a lot.I definitely see a reduction in code generated for the linear annotation, but I've tried several different code patterns to see how much the linear annotation actually improves execution time, and there seems to be no difference.
I've tried alternating nesting calls to a (linear) effect and an effect with a nondeterministic ctl operator, using the linear effect in the polymorphic map function (polymorphism is explicitly mentioned in the documentation as a place where the linear annotation would improve performance). I've also tried a variety of other code patterns, and haven't seen a difference.
Here is some sample code variations that I have tried to craft to see if there was actually a performance benefit. (Changing one_e from effect to linear effect seems to make no difference). I've also tried larger programs.
Beta Was this translation helpful? Give feedback.
All reactions