🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java
Article #282

Re: Will Java kill C++?

#282
From: Tom Payne
Date: Tue, 16 Apr 1996 23:05
36 lines
2174 bytes
Alan L. Lovejoy (alovejoy@concentric.net) wrote:
: 
: I did those benchmars to prove that Smalltalk message sends are faster
: than c function calls.  To do that, I needed a benchmark that consisted

How is that possible, given that the message has to find the entry
point of the method and has to communicate parameters by mechanisms
not unavailable to C.

: mostly of function calls/message sends--and involved as little other
: code as possible.  The recursive factorial and fibonacci functions
: meet those requirements better than anything else I could think of.
: 
: To do any better, you'd need a completely synthetic benchmark.

So, compute the number p(n,k) of ways of writing n as the sum of k
positive numbers (irrespective of ordering), i.e., the number of k-way
partitions of n.  The recursion formula is

      p(n,k)  =  p( n-1, k-1 )  +  p( n-k, k )

i.e., the number of partitions that involve a 1 plus the number that
don't involve a 1.  The boundary conditions are that 
   
      p(n,k) = 1 whenever k is 1 or n  

and

      p(n,k) = 0 whenver k is less than one or greater than n.

The beauty of this application of recursion is that each call
generates two more, without the numbers growing so fast as with
factorial and/or fibonacci (which tend to overflow before 
generating an interesting amount of work).

Tom Payne (thp@cs.ucr.edu)
Technical Details
Message-ID: <4l194e$q11@galaxy.ucr.edu>
Path: arc1-ca.pugleaf.net!galaxy.ucr.edu!not-for-mail
References: <3134D499.653E@ix.netcom.com> <313613B2.136E@ksopk.sprint.com> <4i7qhl$ik6@cronkite.seas.gwu.edu> <4iuhi7$fmf@sundog.tiac.net> <4iumap$mn5@hustle.rahul.net> <31582A45.3742@vmark.com> <3163C031.4FB1@esec.ch> <3164888D.2B01@concentric.net> <4kbfn8$1bu@news1.is.net> <4kqjf6$kh0@kaiwan009.kaiwan.com> <317173F1.5790@concentric.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!galaxy.ucr.edu!not-for-mail
From: thp@cs.ucr.edu (Tom Payne)
Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
Subject: Re: Will Java kill C++?
Followup-To: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
Date: 16 Apr 1996 23:05:50 GMT
Organization: University of California, Riverside
Message-ID: <4l194e$q11@galaxy.ucr.edu>
References: <3134D499.653E@ix.netcom.com> <313613B2.136E@ksopk.sprint.com> <4i7qhl$ik6@cronkite.seas.gwu.edu> <4iuhi7$fmf@sundog.tiac.net> <4iumap$mn5@hustle.rahul.net> <31582A45.3742@vmark.com> <3163C031.4FB1@esec.ch> <3164888D.2B01@concentric.net> <4kbfn8$1bu@news1.is.net> <4kqjf6$kh0@kaiwan009.kaiwan.com> <317173F1.5790@concentric.net>
NNTP-Posting-Host: corvette.ucr.edu
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]