From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public From: brianh@bit3.com Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/02 Message-ID: #1/1 X-Deja-AN: 277407670 References: <3431A2DB.4273@EasyInternet.net> <60ui2q$33a$1@cdn-news.telecom.com.au> <60vj9p$7mg@vidar.diku.dk> <610gbg$k3t@deadzone.rsn.hp.com> Organization: Bit 3 Computer Corp Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec >On the C++ virtual function issue, what is needed is more training of C++ >programmers to avoid inefficient constructs except when they are really >necessary, and to provide whatever language advisories possible to help the >compiler along. While processor speeds continue to increase at exponential >rates, memory latencies are improving much more slowly. Ten years ago, the >cost of a non-cache memory access was less than 10 instructions. Four years >ago, it was less than 40 instructions. Now it is well over 100 instructions >on super-scalar architectures. The exact numbers will vary depending on >which architectural family you look at, but the trend line is clear. And >everything I'm aware of indicates that it will only get worse in the future. >Virtual functions that cannot be optimized to static addresses at compile or >link time are the enemy of performance, and future processor speed >improvements will only make situation more extreme. There's a reason Java defined all methods as virtual methods- and why it was bad that C++ didn't. One of the big advantages of OO programming is code reuse- the problem with this is that you never know, when you write an object, what uses you may put that object to months or years from now. In fact, it is the mark of a good object design when it's used in ways the original author never thought of. The cost of this is (currently) an extra memory reference, which is almost certainly not cached, and possibly even swapped out. We're trying to get away from the model where "this code will only be used in this way in this program" is the norm. Two technologies that may make the situation better, as I see it: 1) Just in time compliation, which can say "In the general case, this needs to be a virtual function, but in this specific case I know it will always be this function." 2) Large, native system libraries, which should be written and compiled by people who really know the system, and only for that system, probably with -no-aliasing flags set (among others). But, in the end, we still have the basic problem: CPUs are way faster than main memory and getting faster. _This_ is the problem, not "bad programming". There is a solution to it (faster memory), but wether or not it's worth it will be determined by the market. And we are seeing, at least in the workstations, more attention being paid to the memory architectures to help allieviate this problem. You're also seeing bigger caches, the other way to allieviate the problem. I don't speak for Bit 3. Brian. > >- Patrick McGehearty >patrick@convex.hp.com -- "NT and security should never be used in the same breath." - Winn Schwartau, EETimes #972, 22 September 1997 pp.96 -Brian