Skip to content

Instantly share code, notes, and snippets.

View Ichoran's full-sized avatar
💭
Ichoran is diffracting imperceptibly (more, with JPEG artifacts)

Ichoran

💭
Ichoran is diffracting imperceptibly (more, with JPEG artifacts)
View GitHub Profile
@Ichoran
Ichoran / Ranged.scala
Created January 25, 2017 04:42
Quick and dirty benchmark of different approaches to Range specialization
package test
class Super[+A] {
def foreach[U](f: A => U): Unit = ???
}
final class Ranged(i0: Int, iN: Int) extends Super[Int] {
override def foreach[@specialized(Unit) U](f: Int => U) {
var i = i0
while (i < iN) {
@Ichoran
Ichoran / GroupByBench.scala
Created November 14, 2016 19:07
Benchmarks for groupBy / map getOrElseUpdate slowdown
import ichi.bench._
object GroupByBench {
class Sum(var value: Int = 0) {
def ++(): this.type = { value += 1; this }
}
val a1k = Array.tabulate(1024)(i => ((i*7) % 13).toString)
val l1k = a1k.toList
val v1k = a1k.toVector