From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA08588; Mon, 27 Sep 2004 18:51:41 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA06000 for ; Mon, 27 Sep 2004 18:51:40 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8RGpCjE007512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 27 Sep 2004 18:51:39 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.13.1/8.12.11) with ESMTP id i8RGp0VP005686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Sep 2004 11:51:02 -0500 (CDT) Date: Mon, 27 Sep 2004 12:01:38 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: skaller cc: caml-list Subject: Re: [Caml-list] C++ STL and template features compared with OCaml parametric polymorphism and OO features In-Reply-To: <1096303081.28613.710.camel@pelican.wigram> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 41584500.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 bloat:01 inlining:01 pointers:01 ocaml:01 sep:01 350:97 objects:02 wrote:03 dynamic:03 stl:03 bunch:03 redirect:95 cycles:04 functions:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 28 Sep 2004, skaller wrote: > Yes, because it costs nothing, which is much cheaper > than the virtual dispatch: This is wrong. It does cost something- it costs code bloat, because now instead of a single copy of the comprehension, you have a whole bunch of copies, one for each time you call the comprehension. This increases cache pressure, and increases the cache miss rate by the whole program, slowing the program down. Note that a cache miss that goes to main memory is 100-350+ clock cycles on modern CPUs. I can do a heck of a lot of work in that time. Note that inlining has the same problem. > No dynamic dispatch is required here. The templates > works with C functions, pointers to C functions, > and function objects. This is the advantage of templates, but it comes at a cost. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners