C++ vs. OCaml: Ray tracer comparison (2005)
ffconsultancy.com
C++ vs. OCaml: Ray tracer comparison (2005)
1–10 of 47 posts
Re: C++ vs. OCaml: Ray tracer comparison (2005)
#2The actual algorithmic lines are very similar in size and readability but when it comes to defining your data structures, F#/OCaml clearly wins.
The author of the website(Jon Harrop) is a very good writer and though his books are expensive I'd recommend them to anyone learning OCaml or F#.
Specifically F#/OCaml for scientists is awesome( it comes in variants for both languages) as is F# for Numerics.
Re: C++ vs. OCaml: Ray tracer comparison (2005)
#3OCaml? Uh... there's F# for realists, Scheme for optimists, and Haskell for pedants. If you're actually writing OCaml web apps in OWebl I'd sure love to know why. Amazon released a native C++ SDK for AWS if you're into pain. If you're using "OPAM" to install the OCaml AWS client... wow.
Re: C++ vs. OCaml: Ray tracer comparison (2005)
#4If you're going to spend the time to implement an algorithm in C++ at least take the time to make it cache aware. Otherwise it's not really surprising when the performance is the same when you're doing the exact same thing.
Would be curious to see what the performance looks like with a tightly packed scene and static dispatch on a discrete number of primitives instead of using virtual functions.
Re: C++ vs. OCaml: Ray tracer comparison (2005)
#5Re: C++ vs. OCaml: Ray tracer comparison (2005)
#6Re: C++ vs. OCaml: Ray tracer comparison (2005)
#7Saying nothing about comparing LOC in an imperative/OO language to a functional one, does the brevity actually help a reader's understanding of the code at all? It seems to me that a lot of the comparisons call out descriptions of explicit actions in C++ where OCaml does the same action implicitly.
That seems like a language trade-off more than a feature.
Re: C++ vs. OCaml: Ray tracer comparison (2005)
#8Re: C++ vs. OCaml: Ray tracer comparison (2005)
#9I work on a project that's a mix of F# and C++ and my code tends to break down very similarly to this. The actual algorithmic lines are very similar in size and readability but when it comes to defining your data structures, F#/OCaml clearly wins. The author of the website(Jon Harrop) is a very good writer and though his books are expensive I'd recommend them to anyone learning OCaml or F#. Specifically F#/OCaml for…
Re: C++ vs. OCaml: Ray tracer comparison (2005)
#10I'm surprised the performance of the two implementations is so close. Aren't floating-point numbers in OCaml usually boxed? Is the compiler smart enough to optimize away the boxes in this situation?
Within functions, the OCaml compiler can assign floats to registers, so those would also be unboxed at least for the duration of the function.
[1] https://realworldocaml.org/v1/en/html/memory-representation-...