Google Groups Home
Help | Sign in
Message from discussion Optimise my ray tracer
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Lasse Reichstein Nielsen  
View profile
 More options 2 Jun 2005, 17:31
Newsgroups: comp.lang.java.programmer
From: Lasse Reichstein Nielsen <l...@hotpop.com>
Date: Thu, 02 Jun 2005 18:31:55 +0200
Local: Thurs 2 Jun 2005 17:31
Subject: Re: Optimise my ray tracer

Jon Harrop <use...@jdh30.plus.com> writes:
> 1. What major optimisations are missing from my program (e.g. in C++, I pass
> vectors by reference and try to inline vector operations).

I'll leave that for now (meaning: I haven't read the program yet :)

Generally, there are several tricks that allows the compiler and
runtime to optimize, like defining variables and field as "final" if
they don't change.

I'm sure Googleing for "java optimizing" will give about a gazillion
links. I know that Peter Sestoft has a file on Java performance on
 <URL:http://www.dina.kvl.dk/~sestoft/javaprecisely/>
which I remember as being good.

> 2. Where is the floating-point machine epsilon in the Java libraries?

I'm not sure what epsilon is to you, but you might want
Double.MIN_VALUE, the smalles positive value representable as a
double.

> 3. How do you do infix operators in Java?

You don't. The designers of Java decided early on that they wanted the
*syntax* to always mean the same thing, making it easier to read other
people's programs (in particular, they didn't want #define, and I guess
overriding infix operators were ruled out for the same reason).

> 4. Am I supposed to have a static main function which instantiates a class
> and invokes a member function of it in order to start the program?

The static "main" function *does* start the program. You want to call
the "run" function from it, and since "run" is not static, you need
to create an object before calling it. However, since "run" doesn't
use that object, the "run" function could have been made static as
well. Likewise the other methods on the class "ray" (classes are
traditionally capitalized).

Anyway, I might have time to look at it some more later :)

> Here's my Java port:

[snip]
A link to an online file would take less room here :)

/L
--
Lasse Reichstein Nielsen  -  l...@hotpop.com
 DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
  'Faith without judgement merely degrades the spirit divine.'


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google