Re: The performance cost of using exceptions?

From: Markus Mottl (mottl@miss.wu-wien.ac.at)
Date: Mon May 15 2000 - 09:31:57 MET DST

  • Next message: Xavier Leroy: "Re: reference initialization"

    > 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
    



    This archive was generated by hypermail 2b29 : Mon May 15 2000 - 22:13:35 MET DST