Skip to content

Instantly share code, notes, and snippets.

Avatar

Ismael Juma ijuma

View GitHub Profile
@ijuma
ijuma / fastMathPerformance
Created Feb 23, 2011
StrictMath vs FastMath vs Math
View fastMathPerformance
Intel Core i7 CPU 860 2.80GHz
Running org.apache.commons.math.util.FastMathTestPerformance
Name StrictMath FastMath Math Runs=10000000 Java 1.6.0_25-ea (1.6.0_25-ea-b01) Java HotSpot(TM) 64-Bit Server VM (20.0-b08)
log 71 1.0 39 0.5555 21 0.2953
log10 94 1.0 108 1.1466 20 0.2174
log1p 74 1.0 103 1.3986 76 1.0269
pow 244 1.0 140 0.5726 238 0.9752
powII 159 1.0 120 0.7582 149 0.9415
exp 53 1.0 26 0.4959 39 0.7323
@ijuma
ijuma / FastMathTestPerformance.java
Created Feb 23, 2011
Modified from the version in Commons Math to fix some micro-benchmarking problems.
View FastMathTestPerformance.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
View sbt 0.9 build error
[ijuma@localhost]~/src/xsbt% sbt update "project Launcher" proguard "project Simple Build Tool" "publish-local"
Getting Scala 2.7.7 ...
:: retrieving :: org.scala-tools.sbt#boot-scala
confs: [default]
4 artifacts copied, 0 already retrieved (11409kB/268ms)
Getting org.scala-tools.sbt sbt_2.7.7 0.7.4 ...
:: retrieving :: org.scala-tools.sbt#boot-app
confs: [default]
15 artifacts copied, 0 already retrieved (4096kB/182ms)
[info] Recompiling project definition...
@ijuma
ijuma / gist:976802
Created May 17, 2011
IDEA JVM settings
View gist:976802
-Xms128m
-Xmx1024m
-server
-XX:MaxPermSize=250m
-ea
-XX:+TieredCompilation
-XX:+UseCompressedOops
-XX:+UseConcMarkSweepGC
-XX:ReservedCodeCacheSize=96m
@ijuma
ijuma / gist:3972753
Created Oct 29, 2012
SBT hang with forked tests
View gist:3972753
Exception in thread "Thread-18" Exception in thread "main" java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2571)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1315)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.react$1(ForkTests.scala:52)
at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.react$1(ForkTests.scala:66)
at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.react$1(ForkTests.scala:56)
at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.react$1(ForkTests.scala:56)
at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.react$1(ForkTests.scala:56)
at sbt.ForkTests$$anonfun$apply$2$Acceptor$2$.react$1(ForkTests.scala:56)
View gist:11222642
object SolrClient {
object Response {
// This was fine in 2.10, but had to be renamed in 2.11
def apply[T](queryResponse: QueryResponse, page: Page)(documentsMapper: SolrDocument => T = identity[SolrDocument] _): Response[T] = ...
}
case class Response[T](
View gist:11261906
println("head: " + events.sortBy(d => d.importedAt.desc).map(_.importedAt).run.head)
println("firstOption: " + events.sortBy(d => d.importedAt.desc).map(_.importedAt).first)
println("run: " + events.map(_.importedAt).sortBy(_.desc).take(1).first)
Output in 2.1.0-M1:
head: 1394563161061
firstOption: 1394116251466
run: 1394563161061
In 2.0.1, all of them print "1394563161061"
View gist:c75a517d6b67969d8a28
method ValidationFlatMapDeprecated in object Validation is deprecated: flatMap does not accumulate errors, use `scalaz.\/` or `import scalaz.Validation.FlatMap._` instead
View whatson
view-source:http://graffiti.internal.timeout.com/public/v1/sites/us-lasvegas/search?when=today&locale=en-US
{"meta":{"url":"http://graffiti.internal.timeout.com/public/v1/sites/us-lasvegas/search?when=today&locale=en-US","total_items":40,"page":{"number":1,"size":10,"next_url":"http://graffiti.internal.timeout.com/public/v1/sites/us-lasvegas/search?when=today&locale=en-US&page_number=2&page_size=10"},"sort":"relevance"},"body":[{"categorisation":{"primary":{"name":"Film","concept":{"name":"film genres"}},"secondary":{"name":"Drama","concept":{"name":"drama"}}},"uid":"Content-Film-156539","id":"156539","name":"Boyhood","description":"Looking at it one way, Boyhood represents a spectacularly cheap way of saving on actors’ salaries: To capture his rambling yet absorbing Texas family drama,...","type":"film","url":"http://graffiti.internal.timeout.com/public/v1/sites/us-lasvegas/films/156539?locale=en-US","has_offer":false,"image_url":"http://media.timeout.com/images/101611109/image.jpg","image":{"id":101611109,
View gist:310294535796ebdf89cb
~/d/p/doobie git:master ❯❯❯ sbt clean test ✱ ◼
[info] Loading project definition from /Users/jumajuma/dev/projects/doobie/project
Missing bintray credentials /Users/jumajuma/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/jumajuma/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/jumajuma/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/jumajuma/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/jumajuma/.bintray/.credentials. Some bintray features depend on this.
[info] Set current project to doobie (in build file:/Users/jumajuma/dev/projects/doobie/)
[warn] Credentials file /Users/jumajuma/.bintray/.credentials does not exist
[warn] Credentials file /Users/jumajuma/.bintray/.credentials does not exist