Skip to content
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

fix more bench warnings #570

Merged
merged 1 commit into from
Dec 14, 2022
Merged

Conversation

satorg
Copy link
Contributor

@satorg satorg commented Dec 14, 2022

For #486
Follow-up to #562
Somehow I overlooked some of the warnings in the bench module.

@@ -44,13 +44,13 @@ class BitSetBenchmarks {
var size: Int = _
var indices: Array[Int] = _

var values: Array[Int] = _
var values: Vector[Int] = _
Copy link
Contributor Author

@satorg satorg Dec 14, 2022

Choose a reason for hiding this comment

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

Starting with v2.13 the compiler complains when Array is passed as a vararg parameter (like immutable.BitSet(values: _*) ) because it involves an implicit conversion to Seq and hence the entire array gets copied for that.

Changing to Vector because it is already Seq so no conversion is necessary.

@@ -77,16 +77,16 @@ class DietAddBench extends BestCaseRangesList {

@Benchmark
def scalazDievAdd(): Unit = {
scalazValues.foldLeft(Diev.empty[Int])((d, r) => d + r)
scalazValues.foldLeft(Diev.empty[Int])((d, r) => d + r): Unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Scala complains here and below that a non-unit value gets discarded.
Ascribing the expression type to Unit helps to calm it down.

@gemelen gemelen merged commit 8f35faf into typelevel:master Dec 14, 2022
@satorg satorg deleted the fix-more-warns-in-bench branch December 14, 2022 17:28
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