On 16/10/12 01:45, Andy Fingerhut wrote:
On Oct 15, 2012, at 5:41 PM, Jim - FooBar(); wrote:

On 15/10/12 22:44, Alan Malloy wrote:
You add the numbers at compile time, and then time how long it takes
to...do nothing to them, at runtime. You are comparing N to zero, not
to some smaller factor of N.

yes but this seems almost unbelievable...i mean for simple numeric operations 
this little trick could provide a tremendous speedup. How come this has not 
been 'advertised' enough? It is my understanding that not even Java could go 
that fast simply because you cannot tap into the compilation process...is there 
code that uses this sort of thing for performance? I'd love to take a peek...

Jim
Most of the time you aren't adding up 10000 values known at compile time.  More 
often you are doing arithmetic on values you do not yet know until run time.  
This trick won't help you in that case.

For the case of arithmetic on compile-time constants, I believe that many C, 
Java, etc. compilers already perform the arithmetic at compile time.

Andy


Ok you're right I get that...what about when we're doing conversion arithmetic like from farenheit to Celcius or from cm to inches where the formula is known and the number we really want to calculate is always 1? this will work there yes?

Jim

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to