[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2000-05-16 (10:37) |
From: | Xavier Leroy <xleroy@p...> |
Subject: | Re: The performance cost of using exceptions? |
> Are programs written to make heavy use of exceptions going to be markedly > slower than programs written more traditionally with loops/ifs, etc? > (My uninformed mental picture of exception is that they would use > some type of underlying setjump/longjump overhead.) The OCaml compiler "knows" about exceptions, so it can implement them more efficiently than setjmp/longjmp. Namely, there is no need to save registers to install an exception handler and to restore them when raising an exception. As rought approximations, I would say that raising an exception costs no more than, say, two calls to unknown functions, and installing an exception handler costs no more than one such call. - Xavier Leroy