Re: Clojure 1.7 and invokeStatic

2014-08-06 Thread Mike Thvedt
It's worth pointing out that var indirection is already cheap in Java--it is generally dominated by IO, memory access, object construction, dynamic dispatch... The JIT compiler will inline any var access if the var doesn't visibly change, and only needs to check one word of memory per var each

Re: Clojure 1.7 and invokeStatic

2014-08-06 Thread Mike Thvedt
I don't want to question your microbenchmarks, but I'm not sure you have the correct interpretation. Read memory fences have little to no cost. In particular, read memory fences are a no-op (literally) on x86 unless the cache line is invalidated. On Wednesday, August 6, 2014 5:54:32 AM UTC-5,

Re: Clojure 1.7 and invokeStatic

2014-08-06 Thread Mike Thvedt
I didn't want to start a flame war, I just didn't want people being misled into thinking static vars are a big perf improvement for most code. It's better do use ordinary dynamic vars unless you're sure it will be beneficial for some tight loop somewhere. The usual case is the JIT inlines the

Re: ANN qarth 0.1.0, an OAuth library

2014-07-25 Thread Mike Thvedt
Heggelund Hansen skinn...@gmail.com javascript: wrote: I was just looking for a OAuth library, this looks great! kl. 19:15:11 UTC+2 torsdag 24. juli 2014 skrev Mike Thvedt følgende: Qarth is a simple interface to OAuth. Qarth's goal is to fix the problem of Ring/Compojure and/or Friend apps

ANN qarth 0.1.0, an OAuth library

2014-07-24 Thread Mike Thvedt
Qarth is a simple interface to OAuth. Qarth's goal is to fix the problem of Ring/Compojure and/or Friend apps reinventing the wheel for OAuth. Qarth features zero-effort Friend integration. The interactive auth flow in friendless Qarth is two or three lines of code plus configuration. All

Re: unexpected behavior of clojure.core/empty

2014-07-19 Thread Mike Thvedt
Is there a reason you want an (empty some-map-entry) to implment IMapEntry? You can already do ordinary modifications on it where it loses the type. Not sure why empty should be an exception. IMapEntry only provides key, val, and java.util.Map.MapEntry, and probably if you're modifying map

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Mike Thvedt
A good implementation of ISeq won't return a new object, and new short-lived objects are cheap on the JVM anyway. OTOH count can be slow for some data structures. if you don't like instantiating lots of new objects only to throw them away, you're missing out on one of HotSpot's most

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Mike Thvedt
. On Monday, May 13, 2013 4:21:54 AM UTC-5, Meikel Brandmeyer (kotarak) wrote: 2013/5/13 Mike Thvedt cynic...@gmail.com javascript: A good implementation of ISeq won't return a new object, and new short-lived objects are cheap on the JVM anyway. OTOH count can be slow for some data

[ANN] Clearley

2013-04-10 Thread Mike Thvedt
ANN: Clearley 0.2.0 https://github.com/mthvedt/clearley Yet another Clojure parser library. Clearley is a parser for people who aren't interested in parsing, and just want to get up and running as quickly as possible processing streams of structured data. Bullet points: * No need to fool