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

Replace cfor with fastFor #1077

Merged
merged 70 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
720bee7
Port macros/util/platform to build in Scala 3
cquiroz Aug 18, 2021
34e7a0c
Port core to dotty
cquiroz Jan 23, 2021
93a8887
Work on the examples
cquiroz Aug 18, 2021
2595a4f
wi
cquiroz Aug 19, 2021
0d187c7
Port laws
cquiroz Aug 20, 2021
473bf1d
Base test port
cquiroz Aug 20, 2021
61ea068
Progress
cquiroz Aug 23, 2021
7b15c82
cfor macro
cquiroz Aug 24, 2021
5b905fb
Port more tests
cquiroz Aug 24, 2021
d5afb83
More tests ported
cquiroz Aug 28, 2021
7e1c1db
Syntax test
cquiroz Aug 28, 2021
427dfb9
More progress
cquiroz Aug 29, 2021
e96f5ad
Safe rational
cquiroz Sep 4, 2021
dc52415
Better Checked macro
cquiroz Sep 4, 2021
cbd7569
Checked work
cquiroz Aug 25, 2021
95c049d
mor progregs
cquiroz Aug 28, 2021
06b9cf2
w
cquiroz Aug 29, 2021
e4ccf77
Fix checked
cquiroz Sep 6, 2021
01fd174
wip3
cquiroz Sep 6, 2021
054508d
More tests
cquiroz Sep 9, 2021
4b6738f
More tests
cquiroz Sep 10, 2021
e10df31
Literal macros
cquiroz Sep 11, 2021
e352d6e
wip
cquiroz Sep 12, 2021
76cc431
Parity
cquiroz Sep 12, 2021
41a43f8
Fix build
cquiroz Sep 12, 2021
80dc82e
Complete literal macros
cquiroz Sep 14, 2021
77b2245
Fixed more tests
cquiroz Sep 14, 2021
d1b6eff
More tests
cquiroz Sep 15, 2021
a0a18fe
More refinements
cquiroz Sep 15, 2021
8130a21
More fixes
cquiroz Sep 15, 2021
a0ab1fd
examples and benchmark
cquiroz Sep 16, 2021
a3a3bc6
FixedPoint tests
cquiroz Sep 16, 2021
938dd1d
More cleanups
cquiroz Sep 16, 2021
78f6f94
Syntax cleanup
cquiroz Sep 16, 2021
2636ef4
Remove checked call in Algebraic
cquiroz Sep 16, 2021
d9c80a0
Build cleanups
cquiroz Sep 16, 2021
f8befcb
Some build improvements
cquiroz Sep 16, 2021
b50af2f
Unify Random Op classes for scala 2 and 3
cquiroz Sep 18, 2021
022061c
Apply suggestions from code review
cquiroz Sep 19, 2021
45943c4
Fix the build references to Scala30
cquiroz Sep 19, 2021
6e41039
Changes out of PR comments and suggestions
cquiroz Sep 20, 2021
e4343eb
Make al empty params methods take no params
cquiroz Sep 18, 2021
d31279d
Remove empty parens methods from random
cquiroz Sep 18, 2021
b9e718f
Further fixes
cquiroz Sep 18, 2021
0e999c1
Fix mismatch on scala2 and scala3 unicode opertors
cquiroz Sep 24, 2021
2df068c
Better name of implicits
cquiroz Sep 24, 2021
61e6bb9
Remove tryOrReturn on scala-3
cquiroz Sep 24, 2021
a22f582
Revert to implicit conversions for syntax
cquiroz Sep 20, 2021
6283538
Progress
cquiroz Sep 23, 2021
dc91ecb
More progress
cquiroz Sep 24, 2021
bc17356
Code cleanup
cquiroz Sep 24, 2021
ac301a4
Fix for Checked failing in a border case in scala 3
cquiroz Oct 1, 2021
0b027f7
Fix code format
cquiroz Oct 1, 2021
079dd27
Include reference to the dotty discussion about Checked
cquiroz Oct 1, 2021
7bf3b7d
Rename cfor to fastFor and deprecate on scala-2
cquiroz Oct 1, 2021
b4c1945
Avoid double conversions on short and byte
cquiroz Oct 3, 2021
bcf1b4c
Remove package object unicode from the scala-3 side and add a sanity …
cquiroz Oct 5, 2021
6f673cd
Reformat code
cquiroz Oct 5, 2021
80f3dbb
Fixed typo
cquiroz Oct 5, 2021
fe5db64
Revert "Rename cfor to fastFor and deprecate on scala-2"
armanbilge Oct 16, 2021
3013e08
Make CforSuite to Scala 2 only
armanbilge Oct 17, 2021
6308677
Switch from cfor to fastFor
armanbilge Oct 17, 2021
6048a58
Fix examples project compile
armanbilge Oct 17, 2021
0ecbd00
Fix benchmark compile
armanbilge Oct 17, 2021
b968633
Deprecate cfor, add scaladocs to fastFor
armanbilge Oct 17, 2021
efb39a8
Optimize Scala2 fastFor, add to benchmark
armanbilge Oct 17, 2021
15134db
Add adjusted closure test to FastForSuite
armanbilge Oct 17, 2021
bdf35af
Add spire-private cfor shims
armanbilge Oct 17, 2021
e304573
Revert all internal uses of fastFor to cfor
armanbilge Oct 17, 2021
239d365
Privatize Scala3 CforSyntax, remove unused import
armanbilge Oct 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.6]
scala: [2.13.6, 3.0.2]
java: [adopt@1.8, adopt@1.11, adopt@1.16]
runs-on: ${{ matrix.os }}
steps:
Expand Down
6 changes: 5 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ docstrings = JavaDoc
newlines.afterCurlyLambda = preserve
docstrings.style = Asterisk
docstrings.oneline = unfold
project.excludeFilters = [ "core/src/main/scala-3.x" ]
project.excludeFilters = [
"core/src/main/scala-3",
"util/src/main/scala-3" ,
"macros/src/main/scala-3"
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import scala.util.Random
import Random._

import spire.syntax.cfor._
import spire.syntax.fastFor._

import Arrays.init

Expand Down Expand Up @@ -356,4 +357,62 @@ class CForBenchmarks {
arr2
}

@Benchmark
def doFastForOr: Long = {
var t: Long = 0L
val len = size - 1
fastFor(0)(_ < len, _ + 1) { i => t = t ^ or(arr(i), arr(i + 1)) }

val len2 = size / 2
fastFor(0)(_ < len2, _ + 1) { i => t = t ^ or(arr(i + 3), arr(i + 2)) }

val len3 = size / 3
fastFor(0)(_ < len3, _ + 1) { i => t = t ^ or(arr(i + 1), arr(i + 2)) }

t
}

@Benchmark
def doFastForMin: Long = {
var t: Long = 0L
val len = size - 1
fastFor(0)(_ < len, _ + 1) { i => t = t ^ min(arr(i), arr(i + 1)) }

val len2 = size / 2
fastFor(0)(_ < len2, _ + 1) { i => t = t ^ min(arr(i + 3), arr(i + 2)) }

val len3 = size / 3
fastFor(0)(_ < len3, _ + 1) { i => t = t ^ min(arr(i + 1), arr(i + 2)) }

t
}

@Benchmark
def doFastForGcd: Long = {
var t: Long = 0L
val len = size - 1
fastFor(0)(_ < len, _ + 1) { i => t = t ^ gcd(arr(i), arr(i + 1)) }

val len2 = size / 2
fastFor(0)(_ < len2, _ + 1) { i => t = t ^ gcd(arr(i + 3), arr(i + 2)) }

val len3 = size / 3
fastFor(0)(_ < len3, _ + 1) { i => t = t ^ gcd(arr(i + 1), arr(i + 2)) }

t
}

@Benchmark
def doFastForIntArrayMultiply: Array[Long] = {
val arr2 = arr.clone
val len = size
fastFor(0)(_ < len, _ + 1) { i =>
{
val value = arr2(i)
arr2(i) = value * 2
}
}
arr2
}

}
Loading