-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check target array length before allocating. #4159
base: series/3.x
Are you sure you want to change the base?
Check target array length before allocating. #4159
Conversation
Thanks for the PR! See also: |
Looks like we need to run |
Sure, I will provide a benchmark of this change later this week. |
I'm not sure my implementation of benchmark is right or not. Since some branch only excuted at a very large parameter, and it cant be test on old code since it will lead to overflow problem. And I'm not familiar with how to do comparative benchmarks between versions. So I just do this compare manually, here is the benchmark result on my laptop.
This result indicates that when the size is small, the performance of the two is comparable. I try to test on large size such as I changed |
If there's anything that needs improvement or additional information, please let me know. I'm happy to make any necessary changes. |
I'll run some benchmarks on this via |
The current implementation of the array inside
ArrayStack
does not verify the length of the new array, and this may lead to overflow problem.cats-effect/core/jvm-native/src/main/scala/cats/effect/ArrayStack.scala
Lines 72 to 78 in ecf93db
Here we add a check on
see also: #4135