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

dale <dale@cs.rmit.edu.au>
21 Apr 2000 23:01:41 -0400

          From comp.compilers

Related articles
Is Java useful for writing (C/C++) compiler vdbent@mail.com (Kees & Annette van der Bent) (2000-04-16)
Re: Is Java useful for writing (C/C++) compiler patrykz@ilion.eu.org (Patryk Zadarnowski) (2000-04-16)
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: dale <dale@cs.rmit.edu.au>
Newsgroups: comp.compilers
Date: 21 Apr 2000 23:01:41 -0400
Organization: rmit
References: 00-04-125 00-04-128 00-04-134 00-04-141
Keywords: errors, performance

Jonathan Barker wrote:


> Thus, if you rely on exceptions for flow of control in a critical loop,
> it is clear that performance will suffer.


I don't think it is all that clear at all. If you consider...


      while not End_Of_File (File) loop
            read file
            blah blah blah
      end loop;


compared to


      begin
            loop
                  read file
                  blah blah blay
            end loop
      exception
            when End_Error =>
                null;
      end;


I would say that the 2nd is -much- more efficient when dealing with
large files.


> Perhaps so, but my guess is that most Java bounds checking cannot be
> eliminated at all. Of course, it can't be done in general. Does anyone
> have any stats on the proportion of bounds checks which can be
> statically eliminated in practice?


It obviously depends on how much you tell the compiler. If you provide
range information in Ada (e.g. subtype Month is Integer range 1..12)
then you can obviously eliminate all checks in an appropriate for
loop.


Presumably languages that let you tell the compiler even more will
do better.


I've heard that at least 1/3 of checks can be removed in "average"
Ada code (whatever that means!).


Dale
[I would say the relative performance of the two loops depends entirely
on how the compiler implements exceptions. -John]





Post a followup to this message

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