newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Jeff on August 22, 2007, 07:09:13 AM

Title: Optimized tail recursion
Post by: Jeff on August 22, 2007, 07:09:13 AM
Is there any optimization of tail recursion in newLisp?
Title:
Post by: Lutz on August 22, 2007, 07:40:07 AM
No, and never will be, if it's tail-recursive it's easy to translate into iteration ;)



Lutz
Title:
Post by: Jeff on August 22, 2007, 07:50:25 AM
This is true.  But it's not nearly as fun.  And truly, that is the one and only measure of any technique ;)
Title:
Post by: Lutz on August 22, 2007, 08:50:28 AM
... here is some other good news: I am redoing the 'count primitive again so we can do this:


(count (sequence 0 127) (unpack (dup "b" (length str)) str))

a lot faster. Currently this takes about 7 seconds on a MacBook and works sorting the data, then counting and comparing with the list of things to count. It should be a lot faster using a hash algorithm and also scale in a linear fashion. The nice thing about 'count is, that it takes a list of any data type or s-expression to be counted.



Lutz
Title:
Post by: Jeff on August 22, 2007, 11:18:02 AM
That's a good idea.  Interestingly enough, it takes about the same amount of time (assuming we are still talking about war and peace) on a quad-core g5.



Any change of including a dostring that iterates over characters quickly?
Title:
Post by: jrh on August 24, 2007, 08:05:57 AM
Quote from: "Jeff" Interestingly enough, it takes about the same amount of time (assuming we are still talking about war and peace) on a quad-core g5.


That's because it is only using one processor.
Title:
Post by: Jeff on August 24, 2007, 08:40:33 AM
True, but it's only using one 2.5GHz processor with 4 gigs of RAM and a very fast 300 GB SATA HD.
Title:
Post by: jrh on August 24, 2007, 09:23:09 AM
The SATA drive should not be a factor either as War and Peace will easily fit into RAM.



I know you are thrilled as all get out by your toy, but frankly I'm not impressed.  Given the current state of OSX and the available compilers, using a quad core for anything but a server seems pretty silly to me.  



Here is a processor that shows evidence of some real engineering talent - i.e. 1 watt @ 500 mhz:



//http://www.linuxdevices.com/news/NS2399097703.html



But then again, I liked the Mac Cube and prefer the Prius to the MurciƩlago.
Title:
Post by: Jeff on August 24, 2007, 09:43:52 AM
SATA makes a difference in reading the file.  Enormous amounts of fast RAM makes a huge difference in processing large lists, such as would be created when unpacking a large string into a list of characters.



If it could do the job using 1 watt, what a world we would live in.



Until then, I am happy to use a super-powerful computer at work that generates enough heat to replace the building's furnace.  I will count characters with it by day and ride it by night.

 

In fact, I have developed a case mod that concentrates the heat generated by the power my machine wastes with its four cores into a super-powerful beam that can cut through bedrock.  Soon, I shall use it to carve my initials in the moon, barring interference from any big, blue superheroes.