Re: Benchmarking structural sharing

2014-08-12 Thread Linus Ericsson
You could likely use System/identityHashCode to count the similarity of objects all the objects. I created a small function that only honors the clojure-visible structure, and exposes every item in a tree structure (apart from the arrays in PersistentVectors and some PersistentMaps) (defn

Re: Benchmarking structural sharing

2014-08-12 Thread Paul Butcher
On 12 August 2014 at 13:49:42, Linus Ericsson (oscarlinuserics...@gmail.com) wrote: The conclusion of this is I think the easiest way to make this work is to just run the algorithm in both versions and watch the object allocation statistics closely in VisualVM or similar. Yeah, that's exactly

Re: Benchmarking structural sharing

2014-08-12 Thread MichaƂ Marczyk
It seems hard to answer in a completely generic fashion. If there's a certain collection of vectors which you'd like to share structure, it may be possible to put a number on the degree of sharing achieved by examining the internals of those vectors. That wouldn't address the issue of intermediate

Benchmarking structural sharing

2014-08-11 Thread Paul Butcher
Is there any way to benchmark the degree of structural sharing achieved by a Clojure algorithm? I'm evaluating two different implementations of an algorithm, one which uses zippers and one which uses rrb-vector. It would be great if there were some way to quantify the degree to which they both