mahout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dawid Weiss <dawid.we...@cs.put.poznan.pl>
Subject Re: Flattened arrays of simple structures (valuetype-like classes).
Date Sat, 26 Mar 2011 20:49:36 GMT
> I must be a total pessimist.  I don't believe in the existence of "correctly written
programs" any more
> than I believe in Santa Claus.

I don't believe in correct programs either, but I believe that you can
be sure enough nothing will break to run without assertions.
Inevitably something WILL break sooner or later (due to software, data
or hardware issue), but enabling assertions or condition checking
won't help you much anyway. But then -- I really don't have a strong
opinion on this and you will be able to easily convert me to your
side, especially if you buy my a german beer in Berlin ;)

>> I guess both viewpoints have pros and cons, so convincing anybody does
>> not make much sense, but it's an interesting discussion nonetheless.
>
> Thank you for putting this so generously.

I didn't mean to be rude and I hope this wasn't understood this way. I
just think this is a matter where different opinions can be equally
well justified and since so it will be hard to find a clear "winning"
side.

> Commonly, I find the risky calls save nothing, especially with modern JVM's.
>  So I put back in the safe calls.

It is so hard to tell, really. Modern JVMs (and modern CPUs) are so
unpredictable in terms of performance... I agree in most cases tiny
optimizations don't make much sense in the global scenario (especially
if micro-benchmarked in isolation). I am just used to thinking in
terms of possible performance losses and this habit (or addiction) is
hard to get rid of.

> setRiskyDontUseThisWithoutAdultSupervision.

This is a good one. I would use it immediately :)

> Did you generate this code using a separate code generator step?  Or using a
> class loader magic thing?
> Can you point us at the heart of the code generator in either case?

I'm sorry I should have made it clear -- this "generator" is actually
an annotation processor that is automatically discovered by javac (or
eclipse's compiler) if found on classpath. In other words it generates
those array classes and immediately compiles them at the same time you
are compiling your sources (and only those classes that are annotated
with @Struct of course). So there is nothing special you need to do
other than make hppc-struct (and its dependencies) available in
compilation classpath or otherwise to javac. This is covered by
JSR175, here:

http://www.jcp.org/en/jsr/detail?id=175

and has been integrated in Java 1.6, so every 1.6 compatible compiler
should be able to make use of it. For javac, the documentation is
here:

http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html#processing

I will create some documentation and a decent example that uses ANT
and Maven, but I wanted to get some feedback first (it is still early
stages). If you use Maven, hppc-examples project on HPPC's github has
a working configuration at the moment. Does this help, at least a
little bit, Ted?

Dawid

Mime
View raw message