Kontorotsui wrote:

> Hello,
>         first of all many thanks to all the people who kindly answered.
>
> I've collected many different advices on Java parsers, so maybe it is wiser to
> explain my purpose.
> I noticed that java performance decreases dramatically as more and more classes
> and object instances are created.
>
> From:
>
> class one
> {
>   int number = 0
>
>   void aMethod()
>     {
>        number++;
>     }
> }
>
> To:
>
> class two
> {
>    myInt number;
>
>    void aMethod()
>      {
>         number.increase();
>      }
> }
>
> class myInt
> {
>   int n = 0;
>
>   void increase()
>   {
>      n++;
>   }
> }
>
> There is no semanthic difference, but if you call aMethod() many times (say
> 10000) the second version is even twice slower.
>
> Yet, the latter version takes advantage of modularity and object structure,
> "good" coding implies that kind of structure.
>
> What I want to do is a tool that "flattens" the class hierachy to improve
> performance. In this way I'll be able to write properly structured code but the
> tool will cut away performance-wise useless classes and method before I compile.
> I know it is not always possible to do that and that the rules to change the
> program must always keep semanthic unchanged... I know this is not easy.
> But suppose I manage to write down a set of rules to do that, I'll need a parser
> to parse the Java code and provide the changed source code according to the
> rules.
>
> After I explained my goal, what would be the best parser to achieve it?

Well some work has been done there
check out
http://altair.parsecweb.com/~kbs/aboutjolt.html
A java to C translater in java .. ( it will I assume have  to flatten the java .. )

Alos check out

http://www.geocities.com/SiliconValley/Orchard/5802/javago/ReadMe.htm

It already does what your wanting to do. Now it seems to break some things. I
havent played with it much.
Plus its in C-- : (

Mike



----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to