"The main thing that helped performance is the avoidance of mixed type arithmetic, that is cases when an operator is called with numbers of different types, such as
(let ((x (sqrt 1.5))) (* x 2))
These mixed-type calls are not handled efficiently. To properly
implement the semantics of Scheme, they are implemented with an
actual function call to the library. Here the (* x 2) will actually
call the "*" function in the library. One transformation I applied
to your code is to convert integer constants to a floating point
value, when the other operand was also a floating point number. For
example:
(let ((x (sqrt 1.5))) (* x 2.0))"
Simply changing the numeric operations to use explicit types indeed increases the speed 2.2x. The second and third image in my previous post now only take ~186s to render instead of ~415s. Impressive! If I optimized the math and tweaked it even further, we'll have a pretty fast raytracer on our hands.
Edit: I meant to post the new source code, you can find it here: schemeray-0.2.tar.gz
3 comments:
Hi, can you update the link to code, please? Thanks!
Please refer to http://jlongster.com/software/ to find the source now. Thanks.
酒店打工
酒店兼職
台北酒店
打工兼差
酒店工作
酒店經紀
禮服酒店
酒店兼差
酒店上班
酒店PT
酒店
酒店喝酒
酒店消費
喝花酒
粉味
喝酒
Post a Comment