Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 3649-ZStream.fromTcpSocketServer
- Loading branch information
Showing
96 changed files
with
1,725 additions
and
958 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
benchmarks/src/main/scala/zio/chunks/ChunkPrependBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package zio.chunks | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
import org.openjdk.jmh.annotations._ | ||
|
||
import zio.Chunk | ||
|
||
@State(Scope.Thread) | ||
@BenchmarkMode(Array(Mode.Throughput)) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
class ChunkPrependBenchmarks { | ||
|
||
val chunk = Chunk(1) | ||
val vector = Vector(1) | ||
|
||
@Param(Array("10000")) | ||
var size: Int = _ | ||
|
||
@Benchmark | ||
def chunkPrepend(): Chunk[Int] = { | ||
var i = 0 | ||
var current = chunk | ||
|
||
while (i < size) { | ||
current = i +: current | ||
i += 1 | ||
} | ||
|
||
current | ||
} | ||
|
||
@Benchmark | ||
def vectorPrepend(): Vector[Int] = { | ||
var i = 0 | ||
var current = vector | ||
|
||
while (i < size) { | ||
current = i +: current | ||
i += 1 | ||
} | ||
|
||
current | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
core-tests/jvm/src/test/scala/zio/CancelableFutureSpecJVM.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package zio | ||
|
||
import java.util.concurrent.Executors | ||
|
||
import scala.concurrent.ExecutionContext | ||
|
||
import zio.duration._ | ||
import zio.internal.Executor | ||
import zio.test.Assertion._ | ||
import zio.test.TestAspect._ | ||
import zio.test._ | ||
|
||
object CancelableFutureSpecJVM extends ZIOBaseSpec { | ||
|
||
import ZIOTag._ | ||
|
||
def spec = | ||
suite("CancelableFutureSpecJVM")( | ||
testM("fromFuture/unsafeRunToFuture doesn't deadlock") { | ||
|
||
val tst = | ||
for { | ||
runtime <- ZIO.runtime[Any] | ||
r <- ZIO.fromFuture(_ => runtime.unsafeRunToFuture(UIO.succeedNow(0))) | ||
} yield assert(r)(equalTo(0)) | ||
ZIO | ||
.runtime[Any] | ||
.map( | ||
_.mapPlatform( | ||
_.withExecutor( | ||
Executor.fromExecutionContext(1)( | ||
ExecutionContext.fromExecutor(Executors.newSingleThreadScheduledExecutor()) | ||
) | ||
) | ||
).unsafeRun(tst) | ||
) | ||
} @@ timeout(1.second) | ||
) @@ zioTag(future) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.