> On Jan 22, 2016, at 1:52 PM, Vladimir Sitnikov <[email protected]> 
> wrote:
> 
> I want something like
> 
> @Setup
> public void ...
> 
> @Benchmark
> public Object columnUniqueness() {
>  return metadataProvider.getColumnUniqueness(whateverArgs);
> }
> 

RelMetadataTest pretty much does that. Copy it, add the @Benchmark annotations, 
and maybe move some code into setup methods.


> Julian> it sounds like you're
> Julian>talking about perfect hashing
> 
> I am.
> FIY: switch(String) is compiled to switch(s.hashCode()) kind of thing.
> Well, the requirements are slightly different, thus map might work
> better for us.

I did consider using switch (r.getClass().getName()), except that janino 
doesn’t support it. But since we have all of the Class objects when we are 
compiling the code, we also know their identity hash codes (i.e. their 
addresses) and we could construct a perfect hash. We could replace 

  switch (relClasses.indexOf(r.getClass())

with

  switch (System.identityHashCode(r.getClass()) % 137)

(replacing 137 with some value chosen by an algorithm)

Julian

Reply via email to