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

add specialization and loop optis benchmark suites #436

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

tnielens
Copy link
Collaborator

Relates to #428.

def array(): Array[Double] = {
var i = 0
while (i < arr.length) {
arr(i) = arr(i) + b
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interestingly, assignment operators seem to harm performance. Here arr(i) += b performs worse.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I must have imagined this, can't reproduce it anymore.

Copy link
Owner

@pityka pityka left a comment

Choose a reason for hiding this comment

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

Thanks!

Do you mind pasting in the output of jmh (the table)?

pityka
pityka previously approved these changes May 30, 2022
@Benchmark
def vecBoxed(): Vec[Double] = {
import org.saddle.ops.BinOps._
v2 /= b
Copy link
Owner

Choose a reason for hiding this comment

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

here, this should be += not? (to be on pair with the other benchmarks which use +)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

indeed, changing this to +=

@pityka pityka merged commit 537db34 into pityka:master Jun 1, 2022
@tnielens
Copy link
Collaborator Author

tnielens commented Jun 1, 2022

Thanks!

Do you mind pasting in the output of jmh (the table)?

[info] Benchmark                                             (size)   Mode  Cnt       Score       Error  Units
[info] LoopOptimisations.arrayAdd                             10000  thrpt   10  842083.647 ± 60290.920  ops/s
[info] LoopOptimisations.arrayAddExpandedAssignmentOperator   10000  thrpt   10  841987.825 ± 65169.011  ops/s
[info] LoopOptimisations.arrayAddHandUnrolled2                10000  thrpt   10  323300.342 ±  6380.595  ops/s
[info] LoopOptimisations.arrayAddHandUnrolled5                10000  thrpt   10  326564.688 ±  3808.226  ops/s
[info] LoopOptimisations.arrayDiv                             10000  thrpt   10  192121.527 ±  3627.980  ops/s
[info] LoopOptimisations.arrayDivHandUnrolled2                10000  thrpt   10   92827.554 ±  6555.253  ops/s
[info] LoopOptimisations.vecBinOps                            10000  thrpt   10  817415.775 ± 75246.139  ops/s
[info] LoopOptimisations.vecBinOpsMacros                      10000  thrpt   10  819505.402 ± 55060.874  ops/s
[info] Benchmark                      (size)   Mode  Cnt          Score          Error  Units
[info] Specialization.vecBoxed            10  thrpt   10   14245974.781 ±   454356.299  ops/s
[info] Specialization.vecBoxed         10000  thrpt   10      13949.961 ±     1351.311  ops/s
[info] Specialization.vecSpecialized      10  thrpt   10  109038414.822 ± 11556578.403  ops/s
[info] Specialization.vecSpecialized   10000  thrpt   10     870143.052 ±    39683.066  ops/s

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