From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA18739 for caml-redist@pauillac.inria.fr; Mon, 15 May 2000 22:10:20 +0200 (MET DST) Resent-Message-Id: <200005152010.WAA18739@pauillac.inria.fr> 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 JAA29713 for ; Mon, 15 May 2000 09:32:11 +0200 (MET DST) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e4F7WAT27353 for ; Mon, 15 May 2000 09:32:10 +0200 (MET DST) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id JAA12847; Mon, 15 May 2000 09:31:57 +0200 (MET DST) From: Markus Mottl Message-Id: <200005150731.JAA12847@miss.wu-wien.ac.at> Subject: Re: The performance cost of using exceptions? To: ortmann@vnet.ibm.com Date: Mon, 15 May 2000 09:31:57 +0200 (MET DST) Cc: caml-list@inria.fr (OCAML) In-Reply-To: from "Daniel Ortmann" at May 13, 2000 04:59:47 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-From: weis@pauillac.inria.fr Resent-Date: Mon, 15 May 2000 22:10:20 +0200 Resent-To: caml-redist@pauillac.inria.fr > Are programs written to make heavy use of exceptions going to be markedly > slower than programs written more traditionally with loops/ifs, etc? That depends on how you use them. It is well possible to do this in such a way that you actually increase performance. For example, when inserting elements into a binary tree, the naive version always copies the "spine" of the tree, even if the element is already a member. But if you use exceptions, you can "jump back" and can thus prevent the spine from being copied. This normally reduces the load of the garbage collector and yields some percent more performance. Best regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl