Newsgroups: comp.graphics.rendering.raytracing
From: "tbp" <tbp...@gmail.com>
Date: 9 May 2005 15:51:11 -0700
Local: Mon 9 May 2005 23:51
Subject: Re: Mini ray tracer
Matt Pharr wrote: You've missed the point. > > [demonstration that "inline" vector math makes C++ programs faster > > elided] a) he's telling the OCaml compiler to inline everything it can while not giving its c++ counterpart opportunities to do so; fairness? b) more importantly he's passing large structures by _value_ and i've turned them into _references_. In fact if you do the same for other hotpath functions as in: > virtual void intersect(double &, Vec &, const Ray &) = 0; 26c28 < double ray_sphere(Ray ray) { // Intersection of a ray with a sphere --- > double ray_sphere(const Ray &ray) { // Intersection of a ray with a sphere 35c37 < void intersect(double &lambda, Vec &normal, Ray ray) { --- > void intersect(double &lambda, Vec &normal, const Ray &ray) { 50c52 < void intersect(double &lambda, Vec &normal, Ray ray) { --- > void intersect(double &lambda, Vec &normal, const Ray &ray) { then the c++ version becomes 50% faster than originally (and in fact, unconditionally faster than the OCaml version), without adding a single line. You'll notice i haven't even fixed the gratitious use of virtual I'm sure OCaml is a wonderful & expressive language, but crafting such > > If your point was to show how to write unbelievably inneficient http://shootout.alioth.debian.org/. code in > > C++, you've succeeded. > I think the point was to have some fun and to make a little demo that > Note also that he mentions on his web page that he's doing this for > That page clearly points out all the caveats around benchmarks like world.) these > (to the point that they can be effectively meaningless in the real I have nothing against such benchmarks when they are not clearly rigged. But i guess the main point of the whole operation wasn't fair Or put another way, that's a sad PR stunt. Have a nice day. 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.
| ||||||||||||||