From: hashi on

http://pastebin.com/fd43e0de

A small contribution I know. I have been told
that this code is "ugly". You may find though
that it performs well.

hashi
From: Dann Corbit on
In article <4b6000e2$0$18229$afc38c87(a)news.optusnet.com.au>,
hashi(a)areya.homeunix.org says...
>
> http://pastebin.com/fd43e0de
>
> A small contribution I know. I have been told
> that this code is "ugly". You may find though
> that it performs well.

Suggestion:
Just compute a huge Pascal's triangle and return the value with a lookup
table.

You may find it performs even better. The downside is that it requires
memory to store the table.

In the event that the requested value is not in the table, code such as
what you have written could be helpful to handle the overflow cases.
From: hashi on
Dann Corbit wrote:
> In article <4b6000e2$0$18229$afc38c87(a)news.optusnet.com.au>,
> hashi(a)areya.homeunix.org says...
>> http://pastebin.com/fd43e0de
>>
>> A small contribution I know. I have been told
>> that this code is "ugly". You may find though
>> that it performs well.
>
> Suggestion:
> Just compute a huge Pascal's triangle and return the value with a lookup
> table.
>
> You may find it performs even better. The downside is that it requires
> memory to store the table.
>
> In the event that the requested value is not in the table, code such as
> what you have written could be helpful to handle the overflow cases.

Fantastic! I have Micheal Abrash' "Zen timer" assembler and will try to
use this to see any performance increase. Thanks :D
From: Dann Corbit on
In article <4b60be0f$0$5423$afc38c87(a)news.optusnet.com.au>,
hashi(a)areya.homeunix.org says...
>
> Dann Corbit wrote:
> > In article <4b6000e2$0$18229$afc38c87(a)news.optusnet.com.au>,
> > hashi(a)areya.homeunix.org says...
> >> http://pastebin.com/fd43e0de
> >>
> >> A small contribution I know. I have been told
> >> that this code is "ugly". You may find though
> >> that it performs well.
> >
> > Suggestion:
> > Just compute a huge Pascal's triangle and return the value with a lookup
> > table.
> >
> > You may find it performs even better. The downside is that it requires
> > memory to store the table.
> >
> > In the event that the requested value is not in the table, code such as
> > what you have written could be helpful to handle the overflow cases.
>
> Fantastic! I have Micheal Abrash' "Zen timer" assembler and will try to
> use this to see any performance increase. Thanks :D

Here is a Windows program to generate arbitrary Pascal's triangles for
you in C code:
http://cap.connx.com/chess-engines/new-approach/pascal.exe.bz2

It is compressed with bzip2:
http://www.bzip.org/

The tables will be accurate, but the constants can easily become to
large for standard C data types, so you will probably need to make
modifications for your specific number type.

From: hashi on
Dann Corbit wrote:
> In article <4b60be0f$0$5423$afc38c87(a)news.optusnet.com.au>,
> hashi(a)areya.homeunix.org says...
>> Dann Corbit wrote:
>>> In article <4b6000e2$0$18229$afc38c87(a)news.optusnet.com.au>,
>>> hashi(a)areya.homeunix.org says...
>>>> http://pastebin.com/fd43e0de
>>>>
>>>> A small contribution I know. I have been told
>>>> that this code is "ugly". You may find though
>>>> that it performs well.
>>> Suggestion:
>>> Just compute a huge Pascal's triangle and return the value with a lookup
>>> table.
>>>
>>> You may find it performs even better. The downside is that it requires
>>> memory to store the table.
>>>
>>> In the event that the requested value is not in the table, code such as
>>> what you have written could be helpful to handle the overflow cases.
>> Fantastic! I have Micheal Abrash' "Zen timer" assembler and will try to
>> use this to see any performance increase. Thanks :D
>
> Here is a Windows program to generate arbitrary Pascal's triangles for
> you in C code:
> http://cap.connx.com/chess-engines/new-approach/pascal.exe.bz2
>
> It is compressed with bzip2:
> http://www.bzip.org/
>
> The tables will be accurate, but the constants can easily become to
> large for standard C data types, so you will probably need to make
> modifications for your specific number type.
>
thanks very much... i have also been looking into gprof on a freebsd
system to profile the new method against old.