Re: generics and arrays and multi-class collections



xen wrote:
Hey Daniel, thanks for the elaborate reply.

On 30 sep, 19:08, Daniel Pitts <googlegrou...@xxxxxxxxxxxxx> wrote:
I hope this makes sense to you, and that you find it helpful. I was
once like you, trying to make sure that my code was as optimized as
possible all the way through. I spent more time creating the
program, and the program usually ended up SLOWER and BUGGIER than when
I followed good OO design principals.

Yes it was helpful. It's not like I'm this performance oriented in
every application I write. It's just that this particular program is
very performance sensitive. I think I'm at an disadvantage already
because I use Java, although I tend to profit from the knowhow
embedded in methods such as BitMap.nextSetBit() and Long.bitCount()
and the clear data model.

I'm not against performance optimizations at all, I'm just saying you should do it as a last step after you've created the "perfect" design (perfect being relative). And you should only do it with the help of profiling tools. In any case, it sounds like you're particular problem needs optimization. Is there some form of time-limit?

Other than that, I'm simply not familiar
with the FreePascal environment and there's no way I'm gonna use C. I
don't like C ;). And Java is quite nice to program in.

grtz, xen.


Java is a lot of fun to program in :-). But whats wrong with C? You can write really elegant programs in C if you know what you're doing. Gotta love function pointers! :-)

Well, good luck on your bot competition.

Cheers,
Daniel.

P.S. Ever heard of AT-Robots? Its a robot simulation game where you pit your robot against other programmers' robots.
.



Relevant Pages

  • Re: A question related to type casting
    ... "List.class" from the overridden method is "final"), how would that returned instance properly reflect on an instance of "__specialised_List"? ... The unfortunate part is that both he and I are falling back on using Java code to try to illustrate something that's not really Java code. ... My whole point from the beginning was with respect to the _general_ case of how the non-reifiable nature of Java generics limits how efficient a generic class can be. ... In other words, in spite of the _potential_ for some specific optimizations, there is a basic and fundamental limitation in generics just as I described at the outset. ...
    (comp.lang.java.programmer)
  • Re: Lisp article at IBM
    ... Flash authoring tool it is just a one-click to produce Executables for ... It is indeed the case that the JVM has to reconstruct information from bytecodes that would be easy to obtain from an AST in order to perform optimizations. ... source from Java byte code. ... When you want to build a platform that is supposed to enable just-in-time compilation or dynamic compilation to achieve performance optimization, it's not a particularly bright idea to base it on technology that actually costs performance. ...
    (comp.lang.lisp)
  • Re: Optimization - any idea of actual machine code?
    ... > I've got some number crunching code I'm thinking of writing in Java, ... > and I'm wondering, after all algorithm-level optimization is done, is ... > some idea of what sort of optimizations it's likely to be capable of? ... Presumably if you're interested in the exact machine code generated, ...
    (comp.lang.java.programmer)
  • Re: Arrays vs Buffers
    ... Are you trying to optimize to see how fast Java can go or do you have actual performance problems? ... JVM's nowadays do some optimizations in this area. ... you might be surprised that this *may* actually have adversary effects depending on your algorithm. ... Also, we're talking about to layers here, Java and the JVM implementation. ...
    (comp.lang.java.programmer)
  • Re: Optimise my ray tracer
    ... >>> many times slower than most other languages. ... (I changed the class name too, to a more traditional Java format). ... I admit to having performed "optimizations" without profiling first, ... like JIT or optimisation flags? ...
    (comp.lang.java.programmer)