Revision 2887b4b9ba506288f7968e4f7d30985359a8c888 authored by brharrington on 07 August 2020, 23:52:44 UTC, committed by GitHub on 07 August 2020, 23:52:44 UTC
Updates the `SmallHashMap.asJavaMap` implementation to override `entrySet()`. The new implementation avoids allocations for each item in the map. **Throughput** | Benchmark | Before | After | % Delta | |----------------------|---------------|---------------|---------| | customEntrySet | 8,400,934.3 | 13,480,190.3 | 60.5 | **Allocations** | Benchmark | Before | After | % Delta | |----------------------|---------------|---------------|---------| | customEntrySet | 296.0 | 24.0 | -91.9 |
1 parent e5482ab
GitVersion.scala
import sbt._
import sbt.Keys._
import sbtrelease.Version
import com.typesafe.sbt.SbtGit._
object GitVersion {
// Base version for master branch
private val baseVersion = "v1.7.x"
// 0.1.x
private val versionBranch = """v?([0-9\.]+)(?:\.x)?""".r
// v0.1.47-31-g230560c
// v0.1.47-20150807.161518-9
private val snapshotVersion = """v?([0-9\.]+)-(?:\d+)-(?:[0-9a-z]+)""".r
// 1.5.0-rc.1-123-gcbfe51a
private val candidateVersion = """v?([0-9\.]+)(?:-rc\.\d+)?-(?:\d+)-(?:[0-9a-z]+)""".r
// v0.1.47
// 1.5.0-rc.1
private val releaseVersion = """v?([0-9\.]+(?:-rc\.\d+)?)""".r
/**
* Needs to check for "false", don't assume it will ever be set to "true".
* http://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
*/
private def isPullRequest: Boolean = sys.env.getOrElse("TRAVIS_PULL_REQUEST", "false") != "false"
/**
* Bump the last git described version to use for the current snapshot. If it is a version branch
* and the prefix doesn't match, then it is the first snapshot for the branch so use the branch
* version to start with.
*/
private def toSnapshotVersion(branch: String, v: String): String = {
val v2 = Version(v).map(_.bump.string).getOrElse(v)
val suffix = "-SNAPSHOT"
branch match {
case versionBranch(b) if !v2.startsWith(b) =>
s"${Version(s"$b.0").map(_.string).getOrElse(v2)}$suffix"
case _ =>
s"$v2$suffix"
}
}
lazy val settings: Seq[Def.Setting[_]] = Seq(
version in ThisBuild := {
val branch = sys.env.getOrElse("TRAVIS_BRANCH", git.gitCurrentBranch.value)
val branchVersion = if (branch == "master") baseVersion else branch
git.gitDescribedVersion.value.getOrElse("0.1-SNAPSHOT") match {
case _ if isPullRequest => s"0.0.0-PULLREQUEST"
case snapshotVersion(v) => toSnapshotVersion(branchVersion, v)
case candidateVersion(v) => s"$v-SNAPSHOT"
case releaseVersion(v) => v
case v => v
}
}
)
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...