Re: Is Java useful for writing (C/C++) compiler

dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner)
21 Apr 2000 23:02:34 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: Is Java useful for writing (C/C++) compiler rsherry@home.com (Robert Sherry) (2000-04-17)
Re: Is Java useful for writing (C/C++) compiler pmb@dina.kvl.dk (Peter Bertelsen) (2000-04-17)
Re: Is Java useful for writing (C/C++) compiler gram@ull.mjolner.dk (Flemming Gram Christensen) (2000-04-20)
Re: Is Java useful for writing (C/C++) compiler iank@bearcave.com (2000-04-20)
Re: Is Java useful for writing (C/C++) compiler jandk@easynet.co.uk (Jonathan Barker) (2000-04-20)
Re: Is Java useful for writing (C/C++) compiler dale@cs.rmit.edu.au (dale) (2000-04-21)
Re: Is Java useful for writing (C/C++) compiler dvdeug@x8b4e53cd.dhcp.okstate.edu (2000-04-21)
Re: Is Java useful for writing (C/C++) compiler nr@labrador.eecs.harvard.edu (2000-04-25)
Re: Is Java useful for writing (C/C++) compiler jandk@easynet.co.uk (Jonathan Barker) (2000-04-25)
Re: Is Java useful for writing (C/C++) compiler bobduff@world.std.com (Robert A Duff) (2000-04-25)
Re: Is Java useful for writing (C/C++) compiler guerby@acm.org (Laurent Guerby) (2000-04-26)
Re: Is Java useful for writing (C/C++) compiler dale@cs.rmit.edu.au (dale) (2000-04-27)
| List of all articles for this month |
From: dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner)
Newsgroups: comp.compilers
Date: 21 Apr 2000 23:02:34 -0400
Organization: Oklahoma State University
References: 00-04-125 00-04-128 00-04-134 00-04-141
Keywords: modula, errors

On 20 Apr 2000 01:34:39 -0400,
  Jonathan Barker <jandk@easynet.co.uk> wrote:
>Obviously, performance depends on how often exceptions occur. It takes
>time to unwind the stack, especially in a language like Java or
>C++. We can't simply perform a jump and set the stack pointer... Since
>the stack trace cannot possibly be known at compile-time (except in
>the simplest cases), the run-time library (or VM) must search each
>frame, executing "finally" clauses and finalising objects until it
>finds a handler for the exception.
>
>Thus, if you rely on exceptions for flow of control in a critical loop,
>it is clear that performance will suffer.


Yes. The Modula-3 people recommend to M3 implementors that exceptions can
be as slow as necessary to make the main code as fast as possible. OTOH,
doing it the C way and checking the return value of every function may
slow a critical loop down more than a rare exception would.


Basically, don't use exceptions to implement a heavily used path of control;
instead, use them for unusual ("exceptional") flow of control.


--
David Starner - dstarner98@aasaa.ofe.org
Finger dvdeug@x8b4e53cd.dhcp.okstate.edu for more information.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.