From: Lars Haugseth Date: 2009-02-18T00:15:02+09:00 Subject: Re: [SUMMARY] Mathematical Image Generator (#191) * Daniel Moore wrote: > > No one got really crazy with performance and created a lookup table > for trigonometric functions, but that may be one way to save cycles, > especially when creating much larger images. After I posted my code here, I did some quick experimentations involving "caching" of sub-expressions not involving x as a factor by calculating those outside the inner loop, storing them in a hash and looking up the value from the hash inside the inner loop. However, in my experience it was faster to actually compute the simple expressions (Math.sin(y), y * y, etc.) than looking them up in a hash. I guess such caching could speed things up a little if one was to cache more complex expressions involving just one of the dimensions, but I deemed it too much effort for too little gain to investigate further. Thank you Daniel. -- Lars Haugseth "If anyone disagrees with anything I say, I am quite prepared not only to retract it, but also to deny under oath that I ever said it." -Tom Lehrer