Article View: comp.lang.java
Article #295Re: Will Java kill C++?
From: Tom Payne
Date: Wed, 17 Apr 1996 15:52
Date: Wed, 17 Apr 1996 15:52
35 lines
2559 bytes
2559 bytes
Alan L. Lovejoy (alovejoy@concentric.net) wrote: : Tom Payne wrote: : > : > 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. : : It's a fact. It's possible because full method lookup only needs to : occur the first time a message is sent to a receiver of a particular : class, not each time a message is sent--and because message sends do not : use "JSR/BSR" machine instructions, but just use simple jumps or : branches. Remember, method contexts are allocated on the heap, not on : the stack. This shows that a particular implementation of Smalltalk message sends is faster than a particular implementation of C function calls, which is both surprising and interesting, but does not show message sends to be inherently faster. (Perhaps, all you are claiming is the relative performance in a particular case.) As I recall, the standard trick for eliminating most of the overhead of method lookups on message sends is to cache the method on each send and next time check for correctness. Of course, this correctness check is overhead that is unnecessary in C. The fact that in this implementation method contexts are allocate on the heap, not the stack, leaves me even more puzzled; heap allocation is no faster, in fact almost always slower, than stack allocation, which merely involves incrementing a pointer. Tom Payne (thp@cs.ucr.edu)
Technical Details
Message-ID:
<4l3432$ebu@galaxy.ucr.edu>Path:
arc1-ca.pugleaf.net!galaxy.ucr.edu!not-for-mailReferences:
<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> <4l194e$q11@galaxy.ucr.edu> <31743669.62A1@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: 17 Apr 1996 15:52:02 GMT Organization: University of California, Riverside Message-ID: <4l3432$ebu@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> <4l194e$q11@galaxy.ucr.edu> <31743669.62A1@concentric.net> NNTP-Posting-Host: corvette.ucr.edu X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]