• (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)                  goto OP4; else
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             goto OP3;

    is absolutely not equivalent to

    START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)                  goto OP4;
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             goto OP3;

    In your example the second line is not nested whitin the first.

    The code IS really real code, written in a way to NOT obfuscate. Try see what my point is, goto's within nested loops is necessary. I am still waiting for the translated version.

    I understand it is not nested but what difference does that make?  Does that change the control flow?

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    The code IS really real code, written in a way to NOT obfuscate. Try see what my point is, goto's within nested loops is necessary. I am still waiting for the translated version.

    Loops?

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    The code IS really real code, written in a way to NOT obfuscate. Try see what my point is, goto's within nested loops is necessary. I am still waiting for the translated version.

    I'm sorry but this is horrible code.  It's completely obfuscated.  Where did you get the idea this was good?

  • James (unregistered) in reply to dubwai

    dubwai:
    You seem to be claiming that C is the ultimate language and it is optimally designed in all ways.  So maybe you should talk to yourself about that.

    Not to state the obvious, but are there things that can be done in a language like 'C' that cannot be done in Java?  Like an <FONT size=6>acceptably performing </FONT>Java VM or non-trival OS?

    Which language/platform is closer to "ultimate"?  It's OK... Most of us already know the answer. :/

  • (cs) in reply to dubwai

    I'm starting to think that maybe English isn't your first language:

    e·quiv·a·lent (-kwv-lnt)
    adj.
    1. Equal, as in value, force, or meaning.
    2. Having similar or identical effects.

  • Bytecodes is not codebytes (unregistered) in reply to dubwai

     

    This is easier for you to read I believe:

     

    START:
    for( i = 0; i < arg1; i += lv)

       if (lv-- > 600*c+randomfunction(c)+c++)

       {           

          goto OP4;     

        } else {        

           OP1:        

           for( j = 0; j < arg1; j += lv)       

           {  

              if (lv+=6 < _rotl(arg1,1)-c++)  

              {       

                  GOTO OP3;    

              } else {               

                /// ... and so on ... ///

             } 

          }
        }

    }

     

    code get to obfuscated for me if I continue typing the whole thing

  • (cs) in reply to dubwai

    dumbass:

    Not to state the obvious, but are there things that can be done in a language like 'C' that cannot be done in Java?  Like an <FONT size=+0>acceptably performing </FONT>Java VM or non-trival OS?

    Which language/platform is closer to "ultimate"?  It's OK... Most of us already know the answer. :/

    It's not obvious because it's not true.  JVMs are more than acceptably performing.  We use them for high volume business transactions all the time.  It often runs too fast and our partner start complaining because we are killing their servers.  And this is using software that was written by people who clearly huff gasoline while coding.

    http://en.wikipedia.org/wiki/Turing_complete

    Doesn't anyone study computer science anymore?  Jesus.

    I never said Java was appropriate for all purposes either.  So why is everyone getting their panties in a bunch?  Am I destroying your misplaced sense of superiority?

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:
    Anonymous:

    START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)                  goto OP4; else
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             goto OP3;

    is absolutely not equivalent to

    START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)                  goto OP4;
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             goto OP3;

    In your example the second line is not nested whitin the first.

    The code IS really real code, written in a way to NOT obfuscate. Try see what my point is, goto's within nested loops is necessary. I am still waiting for the translated version.

    I understand it is not nested but what difference does that make?  Does that change the control flow?

    Alot of difference. It totally changes control flow.

     

    dubwai:
    Anonymous:

    The code IS really real code, written in a way to NOT obfuscate. Try see what my point is, goto's within nested loops is necessary. I am still waiting for the translated version.

    Loops?

     

    Loops as in iterations. A common practice is the for() command, most frequently used with 3 arguments.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

     

    This is easier for you to read I believe:

     

     

    Oh I get it. You are jumping into the middle of loops. And you think this

    is clever.

     

    This is the exact reason goto is criticized.

     

    I can rewrite this in Java. It would involve creating separate functions.

    Now from your statements about 'focus on performance' you probably think

    that's going to slow it down. You would be wrong. The JVM automatically

    methods when they are called repeatedly i.e. when it make a difference.

     

    The point is that you are doing the work that a machine can do. The

    machine can do it better, faster and for less money. You might want to

    check you career path.

     

    I've got to get home. I might show the equivalent Java for what you

    have here (or a portion of it) later if I get the time.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    Loops as in iterations. A common practice is the for() command, most frequently used with 3 arguments.

    I get it.  The define statements.  Very cute.  If you worked for me, I'd consider canning you for writing code like that.

    Have you ever actually benchmarked this code compared to a more... sensibly coded version?  Something that doesn't look like bird shit?

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:
    Anonymous:

    Loops as in iterations. A common practice is the for() command, most frequently used with 3 arguments.

    I get it.  The define statements.  Very cute.  If you worked for me, I'd consider canning you for writing code like that.

    Have you ever actually benchmarked this code compared to a more... sensibly coded version?  Something that doesn't look like bird shit?

     

    I prefer this:

    Anonymous:

    #define FL(v)   for( (v) = 0; (v) < arg1; (v) += lv)

    int function1(int arg1)
    {
     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     
     START: FL(i) if (lv-- > 600*c+randomfunction(c,1)+c++)                goto OP4; else
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             goto OP3; else
     OP2: FL(k) if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1)              goto OP5; else
     OP3: FL(l) if (c>10*arg1+c++)                                         goto OP8; else
     OP4: FL(m) if (lv > arg1-c--)                                         goto OP6; else
     OP5: FL(n) if (arg1 < lv+c++)                                         goto START; else
     OP6: FL(o) if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv,2))  goto OP9; else
     OP7: FL(p) if (lv<500*arg1-c--)      goto OP2; else
     OP8: FL(q) if (lv>50*arg1+randomfunction(c,3))                        goto OP3; else
     OP9: FL(r) if (c += c++ + arg1*10 == 42)                              goto OP2; else
     OP10: FL(s) if (c+=(arg1+=lv/2)+(lv+=arg1*4)!=42)                     goto START;
     
     return arg1;
    };

    ... instead of this:

    Anonymous:

    int function1(int arg1)
    {
     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     
     START: 
     
      for( i = 0; i < arg1; i += lv)
       if (lv-- > 600*c+randomfunction(c,1)+c++)
        goto OP4;
       else


        OP1: 
        for( j = 0; j < arg1; j += lv)
          if (lv+=6 < _rotl(arg1,1)-c++)
           goto OP3;
          else


          OP2:
          for( k = 0; k < arg1; k += lv)
           if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1)
            goto OP5;
           else


            OP3:
            for( l = 0; l < arg1; l += lv)
             if (c>10*arg1+c++)
              goto OP8;
             else


              OP4: 
             for( m = 0; m < arg1; m += lv)
               if (lv > arg1-c--)
                goto OP6;
               else


               OP5:
               for( n = 0; n < arg1; n += lv)
                if (arg1 < lv+c++)
                 goto START;
                else


                 OP6:
                 for( o = 0; o < arg1; o += lv)
                  if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv,2))
                   goto OP9;
                  else


                   OP7:
                   for( p = 0; p < arg1; p += lv)
                    if (lv<500*arg1-c--)
                     goto OP2;
                    else


                     OP8:
                     for( q = 0; q < arg1; q += lv)
                      if (lv>50*arg1+randomfunction(c,3))
                       goto OP3;
                      else


                       OP9:
                       for( r = 0; r < arg1; r += lv)
                        if (c += c++ + arg1*10 == 42)
                         goto OP2;
                        else


                         OP10:
                         for( s = 0; s < arg1; s += lv)
                          if (c+=(arg1+=lv/2)+(lv+=arg1*4)!=42) goto START;
     return arg1;
    };

    Where is the Java-version?

  • James (unregistered) in reply to dubwai

    dubwai:
    dumbass wrote

    Mind yourself.

    dubwai:
    It's not obvious because it's not true. <...Cluck...>

    Read that post again.  The first part asks a question, that part should have been obvious.  But since you seem to have responded to the possible point of the question...  I ask, "where?"  Where can I find things like an acceptably performing OS written in Java?  How about a decent FPS? 

    If you misread the post and did not mean to infer that, then I understand.  Please read it again and provide an appropriate response.

    We are well aware of Java's current niche in the world:  Non-GUI apps running on Big Iron.  It is often much more cost effective to slide another blade into the box than to hire a team of higher-skilled developers to squeeze more performance out of a codebase.  Java thrives in that scenario.

    The point I was, and am, making is this: a language is only as good as its logical, applicable uses.  Perl is highly regarded, but not many people are trying to implement entire large-scale applications with it, even if they can throw big iron at it.  If the problem is that you fail to understand the point, then the problem is that you fail to understand the point.

    Like most experienced developers, I know that things like certain patterns, architectures, and langiages have a place.  My experience has shown that "C" has no place being parsed in a web page, just as Java (proper) has no place in the rendering engine of a hgh-end 3D graphics application.  Obvious AND true.  (Nothing really interesting going on with RTJ, either.)

    dubwai:
    JVMs are more than acceptably performing.  <...Buck-Caw...>  I never said Java was appropriate for all purposes either.  <...Cluck...>  Am I destroying your misplaced sense of superiority?

    Given appropriate hardware (or infinite memory/resources), most things are acceptably performing - if I had two million gallons of Gas at my disposal, I could easly make myself believe that my 9-mile-per-gallon double-cab Ford dualie is acceptably performing.  IIUC, the Java platform scales-up well due to some decent coding in some-language-likely-other-than-Java.  So, yes, I have no doubt that a Java platofrm, written in a language like C/C++, is more than acceptably performing.  The question asks about a Java VM/platform implemented in Java.

    Yes, we already know that Java is not appropriate for all purposes.  Duh.  Again, not the point.  Long before Java was first being run in a browser, we did have languages that pretty much were.  Am I saying that "C" is appropriate for all purposes?  Of course not.  Do I honestly believe that it is appropriate for more purposes than Java?  Yes.  To date, no-one has been able to provide evidence to the contrary.

    Lastly, I have no "misplaced sense of superiority", and if that is what you infer, you are lacking the technical acumen that your posts would (generally) lead others to believe you have.

    (*) And, of course, the native Win32 version runs much faster and has less GUI issues.

  • (cs)

    Hah. C++ users have goto because they can't handle call/cc. ;)

  • (cs) in reply to James

    please register:
    dubwai:
    It's not obvious because it's not true.

    Read that post again.  The first part asks a question, that part should have been obvious.  But since you seem to have responded to the possible point of the question...  I ask, "where?"  Where can I find things like an acceptably performing OS written in Java?  How about a decent FPS? 

    If you misread the post and did not mean to infer that, then I understand.  Please read it again and provide an appropriate response.

    I read it as a statement, not a question.  I apologize for the tone.

    But the implication that there are things that cannot be done in Java that can be done in other languages is clear.  And clearly false.  It may not be feasible or desireable to do certain things in Java at this time, but that's not the same thing as impossible.

    please register:

    We are well aware of Java's current niche in the world:  Non-GUI apps running on Big Iron.  It is often much more cost effective to slide another blade into the box than to hire a team of higher-skilled developers to squeeze more performance out of a codebase.  Java thrives in that scenario.

    I guess all the Java apps I use on my laptop are just figments of my imagination.

    please register:

    The point I was, and am, making is this: a language is only as good as its logical, applicable uses.  Perl is highly regarded, but not many people are trying to implement entire large-scale applications with it, even if they can throw big iron at it.  If the problem is that you fail to understand the point, then the problem is that you fail to understand the point.

    There's a point there?

    please register:

    Like most experienced developers, I know that things like certain patterns, architectures, and langiages have a place.  My experience has shown that "C" has no place being parsed in a web page, just as Java (proper) has no place in the rendering engine of a hgh-end 3D graphics application.  Obvious AND true.  (Nothing really interesting going on with RTJ, either.)

    Are you confusing Java with Javascript?  Java has a 3D engine that is used in commercial applications.  I dislike this omniscient tone.  You don't really seem to have anything to back up these assertions other than your assumptions.

    please register:

    dubwai:
    JVMs are more than acceptably performing.  <...Buck-Caw...>  I never said Java was appropriate for all purposes either.  <...Cluck...>  Am I destroying your misplaced sense of superiority?

    Given appropriate hardware (or infinite memory/resources), most things are acceptably performing - if I had two million gallons of Gas at my disposal, I could easly make myself believe that my 9-mile-per-gallon double-cab Ford dualie is acceptably performing.  IIUC, the Java platform scales-up well due to some decent coding in some-language-likely-other-than-Java.  So, yes, I have no doubt that a Java platofrm, written in a language like C/C++, is more than acceptably performing.  The question asks about a Java VM/platform implemented in Java.

    I'm not sure what your point is.  Are you saying Java's not slow, but it would be it were different?

    please register:

    Yes, we already know that Java is not appropriate for all purposes.  Duh.  Again, not the point.  Long before Java was first being run in a browser, we did have languages that pretty much were. 

    What do browsers have to do with anything?

    register:

    Am I saying that "C" is appropriate for all purposes?  Of course not.  Do I honestly believe that it is appropriate for more purposes than Java?  Yes.  To date, no-one has been able to provide evidence to the contrary.

    Has anyone provided evidence to you that my neighbor's dog isn't god almighty?  I guess you believe that he is.  Lack of evidence is not evidence to the contrary or in this case lack of evidence to the contrary isn't evidence.

    I have seen no evidence that C is more appropriate for more uses than Java.

    please register:

    Lastly, I have no "misplaced sense of superiority", and if that is what you infer, you are lacking the technical acumen that your posts would (generally) lead others to believe you have.

    I really don't know what my assesment of anyone's personaility has to do with "technical acumen" but I'll take the compliment, I guess.

  • Z (unregistered) in reply to dubwai
    dubwai:

    Z:

    The bytecode issue: Java compilers are typically very very bad. They perform no optimizations at all, and reading the code one sees that there is not even a peephole optimizer in them (for non-compiler people: a peephole optimizer is the simplest for of optimizer used in compilers, and also one that is very important for the final result). For example, generated Java bytecode more often than not contains jumps to jumps, which naturally should be folded into one jump. Use javap and read some bytecode, it is entertaining :) Yeah, I know, "the JIT will take care of it" is the standard answer. But if it is VERY simple to fix at compile-time, why not do it?

    I've looked at the bytecodes with javap and I don't see what you are referring to.  Are you talking about old versions (1.2 and lower?)  My understanding is that javac does a lot of optimization.  Also at runtime, it is optimized even further by inlining methods that are called often and loop unrolling (I think).  My understanding is that the main purpose of JIT is compile natively for the platform.



    I've examined code from Javac 1.3 (some version), javac 1.4 (various versions), and from javac 1.5 (some version), as well as code generated by jikes 1.13, 1.17, and 1.18 Unfortunately, I can't remeber how the code produced by gcj 3.4 and 4.0 looked like, so I will not comment on them (it may be better, I'm not sure). Do you hava a better compiler to suggest? Generally, the produced code lacked many simple optimizations that would improve the code.

    The Java runtime sure does many optimizations, but it is at compile-time that one has the time to do some more advanced analyses, in order to improve the code. One reason why Java-compilers are (relatively) simple-minded is that they rely on the runtime for optimizations.

    Btw: I'm sorry to keep responding to you, I see that you have some other strange people in this thread that you are discussing with.
  • Z (unregistered) in reply to dubwai
    dubwai:
    Z:

    Of course we can always invent new statements, but I think that the langages that we use are rather static in that the structures for control-flow are pre-determined.

    And my point is that I don't know of any useful constructs that are not formalized by modern languages.  I am not talking about languages were there are missing structures such as exceptions.


    If exceptions are available, and if they are sufficiently lean to be used for control-flow, then I must say that I don't have any ideas on the top of my head where goto's could be usefull.

    dubwai:
    Z:

    For programs that only use the standard control-flow structures (loops and conditional-blocks), it was proven in "Notes on avoiding 'go to' statements", Donald E. Knuth and Robert W. Floyd, Information Processing Letters 1, February 1971, that in general, the removal of goto-statements cannot be done without using either more memory or doing more computation. This, however, may or may not be interesting to you, depending on the type of systems you are interested in. And as always, we could hope for the Good Compiler to save us, but that is not likely, IMHO.

    If you don't trust compilers, why use them?  Just use machine code.



    I trust compilers, its just that I know that they can never produce optimal code (since it is undecidable). My conjecture is that the extra memory and/or computation incurred by removing goto's can not be removed by a compiler in general, but I may be wrong here.

    I think that it is always interesting to study the kind of code that a compiler generates, and to understand why or why not it performs such-and-such an optimization.

    As a conclusion: I think that your view on systems is much more reasonable than the others that discuss with you in this thread. My points are more nit-picking (proofs for the general case, not practical evaluations), than real arguments. :-)
  • Bytecodes is not codebytes (unregistered) in reply to Z
    Anonymous:
    dubwai:
    Z:

    Of course we can always invent new statements, but I think that the langages that we use are rather static in that the structures for control-flow are pre-determined.

    And my point is that I don't know of any useful constructs that are not formalized by modern languages.  I am not talking about languages were there are missing structures such as exceptions.


    If exceptions are available, and if they are sufficiently lean to be used for control-flow, then I must say that I don't have any ideas on the top of my head where goto's could be usefull.

    Try 10 loops nested inside eachother. Every loop has a label statement. Every loop has an if statement where one of result forward execution to any other label (loop). Exactly all variables should be available to use and alter inside every loop and every if-statement. There is the use for GOTO's, if it could be totally replaced without creating huge increased codesize it would have been revoked from standard C a long time ago. Java is missing this part.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:
    Anonymous:
    dubwai:
    Z:

    Of course we can always invent new statements, but I think that the langages that we use are rather static in that the structures for control-flow are pre-determined.

    And my point is that I don't know of any useful constructs that are not formalized by modern languages.  I am not talking about languages were there are missing structures such as exceptions.


    If exceptions are available, and if they are sufficiently lean to be used for control-flow, then I must say that I don't have any ideas on the top of my head where goto's could be usefull.

    Try 10 loops nested inside eachother. Every loop has a label statement. Every loop has an if statement where one of result forward execution to any other label (loop). Exactly all variables should be available to use and alter inside every loop and every if-statement. There is the use for GOTO's, if it could be totally replaced without creating huge increased codesize it would have been revoked from standard C a long time ago. Java is missing this part.

    If your specifications require this type of logic then I would suggest there is either something wrong with your approach or the specs. I have yet to encounter anything in the real world that meant I had to use something like that.

  • Bytecodes is not codebytes (unregistered) in reply to phelyan
    phelyan:
    Anonymous:
    Anonymous:
    dubwai:
    Z:

    Of course we can always invent new statements, but I think that the langages that we use are rather static in that the structures for control-flow are pre-determined.

    And my point is that I don't know of any useful constructs that are not formalized by modern languages.  I am not talking about languages were there are missing structures such as exceptions.


    If exceptions are available, and if they are sufficiently lean to be used for control-flow, then I must say that I don't have any ideas on the top of my head where goto's could be usefull.

    Try 10 loops nested inside eachother. Every loop has a label statement. Every loop has an if statement where one of result forward execution to any other label (loop). Exactly all variables should be available to use and alter inside every loop and every if-statement. There is the use for GOTO's, if it could be totally replaced without creating huge increased codesize it would have been revoked from standard C a long time ago. Java is missing this part.

    If your specifications require this type of logic then I would suggest there is either something wrong with your approach or the specs. I have yet to encounter anything in the real world that meant I had to use something like that.

    Irrelevant. I use/code/debug/optimize this type of logic daily. Discussion subject is that Java is lacking ability in executing advanced logic.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:
    phelyan:
    Anonymous:
    Anonymous:
    dubwai:
    Z:

    Of course we can always invent new statements, but I think that the langages that we use are rather static in that the structures for control-flow are pre-determined.

    And my point is that I don't know of any useful constructs that are not formalized by modern languages.  I am not talking about languages were there are missing structures such as exceptions.


    If exceptions are available, and if they are sufficiently lean to be used for control-flow, then I must say that I don't have any ideas on the top of my head where goto's could be usefull.

    Try 10 loops nested inside eachother. Every loop has a label statement. Every loop has an if statement where one of result forward execution to any other label (loop). Exactly all variables should be available to use and alter inside every loop and every if-statement. There is the use for GOTO's, if it could be totally replaced without creating huge increased codesize it would have been revoked from standard C a long time ago. Java is missing this part.

    If your specifications require this type of logic then I would suggest there is either something wrong with your approach or the specs. I have yet to encounter anything in the real world that meant I had to use something like that.

    Irrelevant. I use/code/debug/optimize this type of logic daily. Discussion subject is that Java is lacking ability in executing advanced logic.

    Relevant. You cannot discuss advanced logic without real life applications. If your job requires you to use/code/whatever this type of logic daily then Java may not be for you and discussing its ability is moot because you won't be using it. If you do not write code for a living and to business requirements then you have a choice of languages as well. But if your business requirements mean you do not have to write code like this but still do then I would question your abilities as a coder.

  • Bytecodes is not codebytes (unregistered) in reply to phelyan
    phelyan:
    Anonymous:
    phelyan:
    Anonymous:
    Anonymous:
    dubwai:
    Z:

    Of course we can always invent new statements, but I think that the langages that we use are rather static in that the structures for control-flow are pre-determined.

    And my point is that I don't know of any useful constructs that are not formalized by modern languages.  I am not talking about languages were there are missing structures such as exceptions.


    If exceptions are available, and if they are sufficiently lean to be used for control-flow, then I must say that I don't have any ideas on the top of my head where goto's could be usefull.

    Try 10 loops nested inside eachother. Every loop has a label statement. Every loop has an if statement where one of result forward execution to any other label (loop). Exactly all variables should be available to use and alter inside every loop and every if-statement. There is the use for GOTO's, if it could be totally replaced without creating huge increased codesize it would have been revoked from standard C a long time ago. Java is missing this part.

    If your specifications require this type of logic then I would suggest there is either something wrong with your approach or the specs. I have yet to encounter anything in the real world that meant I had to use something like that.

    Irrelevant. I use/code/debug/optimize this type of logic daily. Discussion subject is that Java is lacking ability in executing advanced logic.

    Relevant. You cannot discuss advanced logic without real life applications. If your job requires you to use/code/whatever this type of logic daily then Java may not be for you and discussing its ability is moot because you won't be using it. If you do not write code for a living and to business requirements then you have a choice of languages as well. But if your business requirements mean you do not have to write code like this but still do then I would question your abilities as a coder.

    The problem is there is no other clean way (easy to read, executes fast and so on) to code logic like this.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    The problem is there is no other clean way (easy to read, executes fast and so on) to code logic like this.

    So you opt to code in the language that gives you that ability or else use an unclean way that executes fastest.

  • Bytecodes is not codebytes (unregistered) in reply to phelyan
    phelyan:
    Anonymous:

    The problem is there is no other clean way (easy to read, executes fast and so on) to code logic like this.

    So you opt to code in the language that gives you that ability or else use an unclean way that executes fastest.

    I am sorry, I fail to understand your comment or question. English is far from my best ability.

    Anyway, demonstrate for me a better way to code logic like this:

    (Sidenote: comparison can use and alter any variable including iterator-variables i to s,

    label can be any label inside function, the for-loops can also use and alter any variable)

     

    Anonymous:

    int function1(int arg1)
    {
     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     
     START: 
     
      for( ; i < arg1; i += lv)
       if ( comparison )
        goto label ;
       else


        OP1: 
        for( ; j < arg1; j += lv)
          if ( comparison )
           goto label ;
          else


          OP2:
          for( k = 0; k < arg1; k += lv)
           if ( comparison )
            goto label ;
           else


            OP3:
            for( ; l < arg1; l += lv)
             if ( comparison )
              goto label ;
             else


              OP4: 
             for( ; m < arg1; m += lv)
               if ( comparison )
                goto label ;
               else


               OP5:
               for( ; n < arg1; n += lv)
                if ( comparison )
                 goto label ;
                else

     

                   // .. continue ... //


       return arg1;
    };

  • (cs) in reply to Bytecodes is not codebytes

    My point is that I don't have to demonstrate this. If Java is missing the functionality you need, or makes it more awkward from your point of view then you're free to use another language and, if you have to use Java for the project, load it as a native library. It says nothing about any language's superiority or inferiority over the other...

  • Bytecodes is not codebytes (unregistered) in reply to phelyan
    phelyan:

    My point is that I don't have to demonstrate this. If Java is missing the functionality you need, or makes it more awkward from your point of view then you're free to use another language and, if you have to use Java for the project, load it as a native library. It says nothing about any language's superiority or inferiority over the other...

    Okay sorry, I misunderstood your comment. I had your previous statement: "If your specifications require this type of logic then I would suggest there is either something wrong with your approach or the specs." in mind.

     

    The only thing I am here to declare is that Java is missing out on useful logic.

  • Wind (unregistered) in reply to Bytecodes is not codebytes
    Anonymous:
    [image] Anonymous wrote:

    My point was that Java compilers and JVMs can't be absolutely optimally coded, therefor there is always a way to code a more optimally version. I may call it CoffeVM and it is better than any existing Java compilers and JVMs. The fact itself proves that Java is not faster than C. Java is created using C, and Java is not optimal, it can't be.

    Anyway here comes a more complex codesnippet for you to translate:

    (Concentrate on speed and readability)

     

    int randomfunction(int v)
    {
     
     //  .. superior secret function with superior code, but not relevant 
     
     return v;
    };


    #define FL(v)  for( (v) = 0; (v) < arg1; (v) += lv)

    int function1(int arg1)
    {
     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     
     START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)     goto OP4; else
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)      goto OP3; else
     OP2: FL(k) if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1)    goto OP5; else
     OP3: FL(l) if (c>10*arg1+c++)      goto OP8; else
     OP4: FL(m) if (lv > arg1-c--)      goto OP6; else
     OP5: FL(n) if (arg1 < lv+c++)                                         goto START; else
     OP6: FL(o) if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv)) goto OP9; else
     OP7: FL(p) if (lv<500*arg1-c--)      goto OP2; else
     OP8: FL(q) if (lv>50*arg1+randomfunction(c))     goto OP3; else
     OP9: FL(r) if (c += c++ + arg1*10 == 42)      goto START; else
     OP10: FL(s) if (c+(arg1+=lv/2)+(lv+=arg1*4)!=42)     goto START;
     
     return arg1;
    };

     

                

             Um, this contains define statements.  What exactly does that have to do with goto?  Also, you don't think that putting multiple statements on       a single line makes them faster, do you?

     

    True, the define statement is there so I can nest the goto's within the if statements within the loops where everything is related to each other. Thats the true benefit of the GOTO-command. The define stuff is created to easy the reading up for you, to get my code readable. Putting multiple statements on a single line is not making anything faster, just contributing in readability. But my codesnippet is quite optimized for the task, executiontime, not talking about amount of lines of code here.



    I don't know why you think it's difficult, here's the code without goto in C.


    int function1(int arg1)
    {
     enum OPS {START=0,OP1,OP2,OP3,OP4,OP5,OP6,OP7,OP8,OP9,OP10,END=999};

     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     enum OPS state;

     state = START;

     while (state!=END)
     {
      switch (state)
      {
       case START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)                  { state=OP4; continue; }
       case OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             { state=OP3; continue; }
       case OP2: FL(k) if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1)              { state=OP5; continue; }
       case OP3: FL(l) if (c>10*arg1+c++)                                         { state=OP8; continue; }
       case OP4: FL(m) if (lv > arg1-c--)                                         { state=OP6; continue; }
       case OP5: FL(n) if (arg1 < lv+c++)                                         { state=START; continue; }
       case OP6: FL(o) if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv))    { state=OP9; continue; }
       case OP7: FL(p) if (lv<500*arg1-c--)                                       { state=OP2; continue; }
       case OP8: FL(q) if (lv>50*arg1+randomfunction(c))                          { state=OP3; continue; }
       case OP9: FL(r) if (c += c++ + arg1*10 == 42)                              { state=START; continue; }
       case OP10: FL(s) if (c+(arg1+=lv/2)+(lv+=arg1*4)!=42)                      { state=START; continue; }
       state = END;
      }
     }

     return arg1;
    };

  • Bytecodes is not codebytes (unregistered) in reply to Wind
    Anonymous:
    Anonymous:
    [image] Anonymous wrote:

    My point was that Java compilers and JVMs can't be absolutely optimally coded, therefor there is always a way to code a more optimally version. I may call it CoffeVM and it is better than any existing Java compilers and JVMs. The fact itself proves that Java is not faster than C. Java is created using C, and Java is not optimal, it can't be.

    Anyway here comes a more complex codesnippet for you to translate:

    (Concentrate on speed and readability)

     

    int randomfunction(int v)
    {
     
     //  .. superior secret function with superior code, but not relevant 
     
     return v;
    };


    #define FL(v)  for( (v) = 0; (v) < arg1; (v) += lv)

    int function1(int arg1)
    {
     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     
     START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)     goto OP4; else
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)      goto OP3; else
     OP2: FL(k) if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1)    goto OP5; else
     OP3: FL(l) if (c>10*arg1+c++)      goto OP8; else
     OP4: FL(m) if (lv > arg1-c--)      goto OP6; else
     OP5: FL(n) if (arg1 < lv+c++)                                         goto START; else
     OP6: FL(o) if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv)) goto OP9; else
     OP7: FL(p) if (lv<500*arg1-c--)      goto OP2; else
     OP8: FL(q) if (lv>50*arg1+randomfunction(c))     goto OP3; else
     OP9: FL(r) if (c += c++ + arg1*10 == 42)      goto START; else
     OP10: FL(s) if (c+(arg1+=lv/2)+(lv+=arg1*4)!=42)     goto START;
     
     return arg1;
    };

     

                

             Um, this contains define statements.  What exactly does that have to do with goto?  Also, you don't think that putting multiple statements on       a single line makes them faster, do you?

     

    True, the define statement is there so I can nest the goto's within the if statements within the loops where everything is related to each other. Thats the true benefit of the GOTO-command. The define stuff is created to easy the reading up for you, to get my code readable. Putting multiple statements on a single line is not making anything faster, just contributing in readability. But my codesnippet is quite optimized for the task, executiontime, not talking about amount of lines of code here.



    I don't know why you think it's difficult, here's the code without goto in C.


    int function1(int arg1)
    {
     enum OPS {START=0,OP1,OP2,OP3,OP4,OP5,OP6,OP7,OP8,OP9,OP10,END=999};

     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     enum OPS state;

     state = START;

     while (state!=END)
     {
      switch (state)
      {
       case START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)                  { state=OP4; continue; }
       case OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             { state=OP3; continue; }
       case OP2: FL(k) if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1)              { state=OP5; continue; }
       case OP3: FL(l) if (c>10*arg1+c++)                                         { state=OP8; continue; }
       case OP4: FL(m) if (lv > arg1-c--)                                         { state=OP6; continue; }
       case OP5: FL(n) if (arg1 < lv+c++)                                         { state=START; continue; }
       case OP6: FL(o) if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv))    { state=OP9; continue; }
       case OP7: FL(p) if (lv<500*arg1-c--)                                       { state=OP2; continue; }
       case OP8: FL(q) if (lv>50*arg1+randomfunction(c))                          { state=OP3; continue; }
       case OP9: FL(r) if (c += c++ + arg1*10 == 42)                              { state=START; continue; }
       case OP10: FL(s) if (c+(arg1+=lv/2)+(lv+=arg1*4)!=42)                      { state=START; continue; }
       state = END;
      }
     }

     return arg1;
    };

     

    The reason I think the logic is difficult without GOTO is simply because it IS difficult. Your code does not represent the same logic as mine.

    <FONT face="Courier New">case START: FL(i) if (lv-- > 600*c+randomfunction(c)+c++)                  { state=OP4; continue; }
       case OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             { state=OP3; continue; }</FONT>

    where is code that FL(j) loop is nested inside FL(i) loop? what makes execution go back to <FONT face="Courier New">FL(i) when FL(j) loop is done?</FONT>

  • (cs) in reply to dubwai

    Chlidren, please... :)  As I jump in here to attain some clairity...

    dubwai:
    But the implication that there are things that cannot be done in Java that can be done in other languages is clear.  And clearly false.  It may not be feasible or desireable to do certain things in Java at this time, but that's not the same thing as impossible.

    Well, FWIW, as I asked in an earlier post (that degraded into this thread), can a modern Java platform, with JIT and other performance enhancements, be implemented using the Java platform?  And if you think so, would its per-hardware unit performance, be comparable to a current implementation done in C/C++?  And, to your point, would it be "feasible or desireable?"  Can any of those questions be answered more favorably if you use C/C++?  No absolutes here, just relative to one another.

    Personally, if I wanted to write a data processing application that would scale up easily, where the platform would take care of most of what is considered to be the hard work (like threading, memory management, some resource contention, etc.), and as such I could use less experienced developers to do it (compared to using C/C++, where you generally need more experienced developers to correctly do things like threading, memory management, etc.), then J2EE would get a much more favorable vote.

    If I wanted to write a FPS or RTS game, then I would likely choose C/C++ over Java (or .Net for that matter).

    Both projects could possibly be written in C/C++, Java, C#, Oberon, CoBOL, whatever, and they might actually "work".  But the concept of "works" should never be confused with the concept of "correct". Althouth, IMHO, that is a very common problem today, as code snippets posted to this site will indicate. [8-|]

    dubwai:
    I guess all the Java apps I use on my laptop are just figments of my imagination.

    How about laptops for the average user in the world?  Comparing the contents of your laptop to mine would be unfair; mine would tend to slant depending on my language of choice, applications I tend to use, etc., as would yours.

    dubwai:
    Are you confusing Java with Javascript?

    Well, correct me if I am wrong, but if I remember correctly, Java got its first "real" (meaning widespread and accepted) use as and in browsers.  First HotJava, and then Java support in other browsers (this was long before things like JavaScript).  So to be fair, the poster's mention of Java and a browser is mostly correct, with the exception that Java is not really "parsed", it is directly interpreted/executed.  Mind you, I am liekly dating myself here :).  I can still hear the cries of "write once run everywhere!"

    dubwai:
    Java has a 3D engine that is used in commercial applications.  I dislike this omniscient tone.  You don't really seem to have anything to back up these assertions other than your assumptions.

    Well, personally (when I still qualified for a subscription to Game Developer magazine), I rarely heard about anything like that being used in any high-performance games or engines.  Times may have changed for the better, they may have changed for the worse, they may not have changed at all.  Today's MMORPG-type games might be a good use for things like J2EE, as they need to scale up and out, and really only need to maintain the state of things.  But I believe that would be a hard sell to gaming companies even today.

    To be fair, last I knew, even the largest-scale J2EE business applications tend to not use Java-implemented databases or messaging systems.  Would you agree?  Or have time changed since I last had to do anything with J2EE?  Granted, things like Hypersonic exist, but these appear to be the exception and not the rule.  However, I do not relish the thought of getting into a heated discussion with your about the feasiblility and desireability of such things.

    In the end, experienced developers are going to do what they think is best, based on their knowledge, wisdom and experience.  (Even if it is not really correct to do so. :)).  In the absense of any evidence (as you define its requirements), I think it would be best for everyone to just agree to disagree and leave it at that.  I know the capabilities of C/C++ better than I know those of Java, and I am guessing the same goes for you with Java .vs. C/C++.  In that, we each have our own "niche" in this world and should accept and relish in it rather than try to kick each other in the balls.

    Peace!

  • (cs) in reply to jtwine
    jtwine:

    Chlidren, please... :)  As I jump in here to attain some clairity...

    dubwai:
    But the implication that there are things that cannot be done in Java that can be done in other languages is clear.  And clearly false.  It may not be feasible or desireable to do certain things in Java at this time, but that's not the same thing as impossible.

    Well, FWIW, as I asked in an earlier post (that degraded into this thread), can a modern Java platform, with JIT and other performance enhancements, be implemented using the Java platform?  And if you think so, would its per-hardware unit performance, be comparable to a current implementation done in C/C++?  And, to your point, would it be "feasible or desireable?"  Can any of those questions be answered more favorably if you use C/C++?  No absolutes here, just relative to one another.

    I don't doubt that a program written in C or C++ will probably run faster than an equivalent one in Java.  However, equivalent is really hard to put my finger on in this case.  The point I am trying to make is that people are saying C and C++ are faster than Java as if it was written on stone tablets and brought down the mountain by Moses.  I won't quibble if people suggest that there is extra overhead involved with Java.  But when people state that 'Java is too slow for me' as if it were a fact, I want to see what evidence they are basing this on.  Each version of the Java platform has been significantly faster than the previous version.

    http://www.idiom.com/~zilla/Computer/javaCbenchmark.html

    jtwine:

    Personally, if I wanted to write a data processing application that would scale up easily, where the platform would take care of most of what is considered to be the hard work (like threading, memory management, some resource contention, etc.), and as such I could use less experienced developers to do it (compared to using C/C++, where you generally need more experienced developers to correctly do things like threading, memory management, etc.), then J2EE would get a much more favorable vote.

    I think you need to be careful here.  J2EE != Java.  It's a framework built on Java.  Also, they are dropping the 'J2' from everything.

    jtwine:

    If I wanted to write a FPS or RTS game, then I would likely choose C/C++ over Java (or .Net for that matter).

    Both projects could possibly be written in C/C++, Java, C#, Oberon, CoBOL, whatever, and they might actually "work".  But the concept of "works" should never be confused with the concept of "correct". Althouth, IMHO, that is a very common problem today, as code snippets posted to this site will indicate. [8-|]

    I never said anything to the contrary.

    jtwine:
    dubwai:
    I guess all the Java apps I use on my laptop are just figments of my imagination.

    How about laptops for the average user in the world?  Comparing the contents of your laptop to mine would be unfair; mine would tend to slant depending on my language of choice, applications I tend to use, etc., as would yours.

    I don't see your point.  I was contradicting a specific point stating that Java only runs on big iron.  Last time I checked, my laptop and home machine were not big iron.

    jtwine:
    dubwai:
    Are you confusing Java with Javascript?

    Well, correct me if I am wrong, but if I remember correctly, Java got its first "real" (meaning widespread and accepted) use as and in browsers.  First HotJava, and then Java support in other browsers (this was long before things like JavaScript).  So to be fair, the poster's mention of Java and a browser is mostly correct, with the exception that Java is not really "parsed", it is directly interpreted/executed.  Mind you, I am liekly dating myself here :).  I can still hear the cries of "write once run everywhere!"

    Now the phrase is 'write once test everywhere'.  Java applets are where Java got it's fame, I'll give you that but an Applet isn't really running in a browser.  It's slight of hand.

    jtwine:
    dubwai:
    Java has a 3D engine that is used in commercial applications.  I dislike this omniscient tone.  You don't really seem to have anything to back up these assertions other than your assumptions.

    Well, personally (when I still qualified for a subscription to Game Developer magazine), I rarely heard about anything like that being used in any high-performance games or engines.  Times may have changed for the better, they may have changed for the worse, they may not have changed at all.  Today's MMORPG-type games might be a good use for things like J2EE, as they need to scale up and out, and really only need to maintain the state of things.  But I believe that would be a hard sell to gaming companies even today.

    It could be for good reason, it could also just be because everyone in that market agrees that Java isn't good for games.  That's very different from showing that it is the case.  That's the 'a million Elvis fan's can't be wrong' fallacy.

    I know the at least one version of the 'Law and Order' video game was written using Java and is a 3D game (first person or similar.)

    jtwine:
    To be fair, last I knew, even the largest-scale J2EE business applications tend to not use Java-implemented databases or messaging systems.  Would you agree?  Or have time changed since I last had to do anything with J2EE?  Granted, things like Hypersonic exist, but these appear to be the exception and not the rule.  However, I do not relish the thought of getting into a heated discussion with your about the feasiblility and desireability of such things.

    Again, just because it's not being done doesn't mean it's not possible.  I know of no large scale mainframe applications that are running C++ applications.  Does that mean that C++ is not appropriate for business?  Does it make COBOL superior to C++?  There's no good reason to write a DB in Java.  That has nothing to do with whether Java is slow or not.

    jtwine:

    In the end, experienced developers are going to do what they think is best, based on their knowledge, wisdom and experience.  (Even if it is not really correct to do so. :)).  In the absense of any evidence (as you define its requirements), I think it would be best for everyone to just agree to disagree and leave it at that.  I know the capabilities of C/C++ better than I know those of Java, and I am guessing the same goes for you with Java .vs. C/C++.  In that, we each have our own "niche" in this world and should accept and relish in it rather than try to kick each other in the balls.

    Peace!

    I agree and I welcome well reasoned out points like your own.   What I don't care for is "everyone knows Java is slow and it's a fact" type comments.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:
    phelyan:

    My point is that I don't have to demonstrate this. If Java is missing the functionality you need, or makes it more awkward from your point of view then you're free to use another language and, if you have to use Java for the project, load it as a native library. It says nothing about any language's superiority or inferiority over the other...

    Okay sorry, I misunderstood your comment. I had your previous statement: "If your specifications require this type of logic then I would suggest there is either something wrong with your approach or the specs." in mind.

     

    The only thing I am here to declare is that Java is missing out on useful logic.

    I am busy at work right now and I will address how that code could be written in Java.  The Java version will admittedly have more overhead but whether that amounts to a significant performance hit is not showable without a side by side comparison.

    On a side, note, I don't find the logic you have used to be clean.  In the light of new 2 core CPUs coming out for PCs and the planned 4 core, and 16 core CPUs planned in the near future, how would you modify that code to be able to run in parallel?  The Java version I will present will be reasonably easy to convert to a multithreaded version.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    #define FL(v)   for( (v) = 0; (v) < arg1; (v) += lv)

    int function1(int arg1)
    {
     int c,i,j,k,l,m,n,o,p,q,r,s;
     c=i=j=k=l=m=n=o=p=q=r=s=0;
     int lv = _rotl(arg1, 4);
     
     START: FL(i) if (lv-- > 600*c+randomfunction(c,1)+c++)                goto OP4; else
     OP1: FL(j) if (lv+=6 < _rotl(arg1,1)-c++)                             goto OP3; else
     OP2: FL(k) if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1)              goto OP5; else
     OP3: FL(l) if (c>10*arg1+c++)                                         goto OP8; else
     OP4: FL(m) if (lv > arg1-c--)                                         goto OP6; else
     OP5: FL(n) if (arg1 < lv+c++)                                         goto START; else
     OP6: FL(o) if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv,2))  goto OP9; else
     OP7: FL(p) if (lv<500*arg1-c--)      goto OP2; else
     OP8: FL(q) if (lv>50*arg1+randomfunction(c,3))                        goto OP3; else
     OP9: FL(r) if (c += c++ + arg1*10 == 42)                              goto OP2; else
     OP10: FL(s) if (c+=(arg1+=lv/2)+(lv+=arg1*4)!=42)                     goto START;
     
     return arg1;
    };

    You were a SNOBOL programmer in a previous life, weren't you?

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:
    Anonymous:
    phelyan:

    My point is that I don't have to demonstrate this. If Java is missing the functionality you need, or makes it more awkward from your point of view then you're free to use another language and, if you have to use Java for the project, load it as a native library. It says nothing about any language's superiority or inferiority over the other...

    Okay sorry, I misunderstood your comment. I had your previous statement: "If your specifications require this type of logic then I would suggest there is either something wrong with your approach or the specs." in mind.

     

    The only thing I am here to declare is that Java is missing out on useful logic.

    I am busy at work right now and I will address how that code could be written in Java.  The Java version will admittedly have more overhead but whether that amounts to a significant performance hit is not showable without a side by side comparison.

    On a side, note, I don't find the logic you have used to be clean.  In the light of new 2 core CPUs coming out for PCs and the planned 4 core, and 16 core CPUs planned in the near future, how would you modify that code to be able to run in parallel?  The Java version I will present will be reasonably easy to convert to a multithreaded version.

    The logic in my code snippet can't take advantage from multi-threading to be executed faster. More versions of the same function running in different threads is the only way, then it can be altered so the average execution-time is less. The single function is so dependent on recently used variables to continue at all. This function alone does not benefit at all being modified to a multithreaded version. Now, show me a more clean way for the same purpose using Java, C++, Perl or whatever.

  • (cs) in reply to Bytecodes is not codebytes

    Anonymous:
    The logic in my code snippet can't take advantage from multi-threading to be executed faster. More versions of the same function running in different threads is the only way, then it can be altered so the average execution-time is less. The single function is so dependent on recently used variables to continue at all. This function alone does not benefit at all being modified to a multithreaded version. Now, show me a more clean way for the same purpose using Java, C++, Perl or whatever.

    It was difficult to understand the code you have given because of all the basic rules of writing good code that you have broken here.   I wasn't sure where the return belongs so I made an educated guess.  I am sure there is a much better way to approach this problem given the requirements but I believe this gives the same basic program flow:

    abstract class Operation
    {
        static final int START = 0;
        static final int OP1 = 1;
        static final int OP2 = 2;
        static final int OP3 = 3;
        static final int OP4 = 4;
        static final int OP5 = 5;
        static final int OP6 = 6;
        static final int OP7 = 7;
        static final int OP8 = 8;
        static final int OP9 = 9;
        static final int OP10 = 10;
        static final int END = -1;
       
        static int lv;
        static int arg1;
        static int c;
       
        int counter;
       
        public int execute(boolean reset)
        {
            if (reset) counter = 0;
               
            if (counter < arg1){
                counter += lv;
               
                return executeInner();
            }
               
            return END;
        }
       
        abstract int executeInner();
       
        static int randomfunction(int c, int d)
        {
            return 0;
        }
       
        static int _rotl(int a, int b){
            return 0;
        }
       
        static int _rotr(int a, int b){
            return 0;
        }
       
        public static int function1(int arg1)
        {
            final Operation start = new Start();
            final Operation op1 = new Op1();
            final Operation op2 = new Op2();
            final Operation op3 = new Op3();
            final Operation op4 = new Op4();
            final Operation op5 = new Op5();
            final Operation op6 = new Op6();
            final Operation op7 = new Op7();
            final Operation op8 = new Op8();
            final Operation op9 = new Op9();
            final Operation op10 = new Op10();
           
            Operation current = start;
            lv = _rotl(arg1, 4);
           
            boolean reset = true;
           
            while(true)
            {
                int next = current.execute(reset);
               
                reset = true;
               
                switch (next)
                {
                    case START:
                        current = start;
                    case OP1:
                        current = op1;
                    case OP2:
                        current = op2;
                    case OP3:
                        current = op3;
                    case OP4:
                        current = op4;
                    case OP5:
                        current = op5;
                    case OP6:
                        current = op6;
                    case OP7:
                        current = op7;
                    case OP8:
                        current = op8;
                    case OP9:
                        current = op9;
                    case OP10:
                        current = op10;
                    case END:
                        reset = false;
                       
                        if (current == start) return arg1;
                        if (current == op1) next = START;
                        if (current == op2) next = OP1;
                        if (current == op3) next = OP2;
                        if (current == op4) next = OP3;
                        if (current == op5) next = OP4;
                        if (current == op6) next = OP5;
                        if (current == op7) next = OP6;
                        if (current == op8) next = OP7;
                        if (current == op9) next = OP8;
                        if (current == op10) next = OP9;
                     default:
                         throw new IllegalStateException();
                }
            }
        }
    }

    class Start extends Operation
    {
       
        int executeInner()
        {
            if (lv-- > 600*c+randomfunction(c,1)+c++) return OP4;
            else return OP1;
        }
    }

    class Op1 extends Operation
    {
       
        int executeInner()
        {
            if ((lv+=6) < _rotl(arg1,1)-c++) return OP3;
            else return OP2;
        }
    }

    class Op2 extends Operation
    {
       
        int executeInner()
        {
            if ( (lv += _rotr(lv, arg1) / 1.5 /4) > arg1) return OP5;
            else return OP3;
        }
    }

    class Op3 extends Operation
    {
       
        int executeInner()
        {
            if (c>10*arg1+c++) return OP8;
            else return OP4;
        }
    }

    class Op4 extends Operation
    {
       
        int executeInner()
        {
            if (lv > arg1-c--)return OP6;
            else return OP5;
        }
    }

    class Op5 extends Operation
    {
       
        int executeInner()
        {
            if (arg1 < lv+c++) return START;
            else return OP6;
        }
    }

    class Op6 extends Operation
    {
       
        int executeInner()
        {
            if ((lv += _rotr(lv, arg1)) / 1.5 > randomfunction(lv,2)) return OP9;
            else return OP7;
        }
    }

    class Op7 extends Operation
    {
       
        int executeInner()
        {
            if (lv<500*arg1-c--) return OP2;
            else return OP8;
        }
    }

    class Op8 extends Operation
    {
        int executeInner()
        {
            if (lv>50*arg1+randomfunction(c,3))return OP3;
            else return OP9;
        }
    }

    class Op9 extends Operation
    {
        int executeInner()
        {
            if ((c += c++ + arg1*10) == 42) return OP2;
            else return OP10;
        }
    }

    class Op10 extends Operation
    {
        int executeInner()
        {
            if ((c+=(arg1+=lv/2)+(lv+=arg1*4))!=42) return START;
            else return END;
        }
    }

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:

    Anonymous:
    The logic in my code snippet can't take advantage from multi-threading to be executed faster. More versions of the same function running in different threads is the only way, then it can be altered so the average execution-time is less. The single function is so dependent on recently used variables to continue at all. This function alone does not benefit at all being modified to a multithreaded version. Now, show me a more clean way for the same purpose using Java, C++, Perl or whatever.

    It was difficult to understand the code you have given because of all the basic rules of writing good code that you have broken here.   I wasn't sure where the return belongs so I made an educated guess.  I am sure there is a much better way to approach this problem given the requirements but I believe this gives the same basic program flow:

    You are trying to defeat my statements with the wrong arguments. Here is a simplified list of statements and arguments made:

    Me: First off I wrote a simple function with labels and goto calls and said I whould be happy if you showed me a Java version
    of the same code. I stated that a compiled java-version of the same thing impossible could be executed faster than my code.
    The current discussion was 'Java is not slow' and that you had 'never seen code where GOTO's is neccessary'

    You: Replied with a Java-version of my codesnippet. It clearly demonstrated that GOTO's was unneccessary in that logic. Your Java code was
    slightly bigger. There were no difference in readability for what I can tell. Nothing mentioned about execution-speed.

    Me: I posted a more complex codesnippet involving nested loops and goto's.

    You\me: Trying to sort out my code-writing style.
     Me: Wrote it like that to not pollute the whole forum with terrible-looking nested loops.
     
     You: It's completely obfuscated.
     
     Me: Posted a terrible-looking version with complete written nested loops and polluted the forum.
     

    You: Goto's is criticized for this exact reason, regarding jumps into the middle of loops. Create the same functionality
     using separate function is better, the machine can do the optimizing, and can do it better. Still complaining about
     coding style.
     
    Me: Posted full version of the code in my way of writing it, and a full version in somewhat standard way of writing it.

    You: Java-version will have more overhead, significant performance difference can't be told until properly compared.
           Your logic is not clean, asking how I will modify the code in future to take advantage over multithreading.
     
    Me: My codesnippet alone can't take advantage using several threads. Only if several versions of the same function is running
           parallell on the same computer you can get increased performance by redesigning the logic for a multiCPU/multithreaded platform.
     
    Nothing said about in what environment this function is supposed to execute before, nothing said about anything related to multithreading
    and such.

    There are to many statements being told so we have no chance in sorting out the first ones, the first ones is the only ones I care for.
    Therefor I would be happy if we stuck to the subject and:
        Quit making new statements
        Quit getting many more variables into the already messed up discussion
     
    I see a pattern in your comments, you always seek to get to much things involved so you have a chance to find good targetstatements to
    argument about.

    As for me, my opinion is that we have gotten nowhere. I still claim GOTO's is neccessary, I want to see a Java-version that is somewhat
    equally readable and somewhat equally fast.

    Now I have a Java-version. The readability is quite not in the same class as my C-version, I really dont know yet if the logic is the same.
    Performance-wise will my C-version outclass your Java-version, but I guess you dont believe that until you have runned a test infront of
    your own eyes, so I will not try prove it to you.

    Nothing new here, my initial thoughts about GOTO statements and about Java's inability to create equivalent code still remains.

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:

    Anonymous:
    The logic in my code snippet can't take advantage from multi-threading to be executed faster. More versions of the same function running in different threads is the only way, then it can be altered so the average execution-time is less. The single function is so dependent on recently used variables to continue at all. This function alone does not benefit at all being modified to a multithreaded version. Now, show me a more clean way for the same purpose using Java, C++, Perl or whatever.

    It was difficult to understand the code you have given because of all the basic rules of writing good code that you have broken here.   I wasn't sure where the return belongs so I made an educated guess.  I am sure there is a much better way to approach this problem given the requirements but I believe this gives the same basic program flow:

    Btw, before you feel to much pride over your accomplishment..

    I posted one version with somewhat standard codestyle, so you have no reason to claim you can't code an equivalent version for the reason that the code was to obfuscated.

    What I forgot to mention in previous reply: The whole Java-thingy you posted is based on the equiality of the structure of the code I posted, which I did to make is as readable as possible, and clarily showed the goto-labels-inside-of-nested-loops issue. What if I have the iterator variables from other loops inside the if-statements? what if the labels is not placed on equally spot in every loop? (like inside of comparison-statements?) what if the nesting was not a straightforward one-loop-inside-another approach? whould you still be confident saying "GOTO's is not neccessary, I find an equal way of coding this, and better way, just give me like.... say ... 2 months..okay?" ..

    Your claim: Goto's is not neccessary, there is equivalent and better ways to code everything that is using GOTO's.

    Then I can claim: Java and all other high level programming languages is unneccessary, there is equivalent and better ways to code everything in assembler or machinecode.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    [I thought I had code that couldn't be replicated without gotos... blah blah blah.]

    As for me, my opinion is that we have gotten nowhere. I still claim GOTO's is neccessary, I want to see a Java-version that is somewhat
    equally readable and somewhat equally fast.

    You are combining two arguments that I have made separately.  Java is not slow in general.  Gotos are not strictly necessary.  I never said that all code written with gotos can be rewritten without them in Java and execute equally fast.  This is basic logic.  You need to address the points I've made, not your misrepresentation of them.

    Anonymous:

    Now I have a Java-version. The readability is quite not in the same class as my C-version,

    Do you mean that mine is actually readable?  It took me quite a while to figure out what your code was doing.  Maybe a comment or too would help.  I'd be interested to see a poll here on which version is easier to understand.

    Your version is something I would expect to see posted as a WTF here.

    Anonymous:

    I really dont know yet if the logic is the same.
    Performance-wise will my C-version outclass your Java-version, but I guess you dont believe that until you have runned a test infront of
    your own eyes, so I will not try prove it to you.

    Nothing new here, my initial thoughts about GOTO statements and about Java's inability to create equivalent code still remains.

    I posted an definition of 'equivalent' before.  I suggest you reread it.

  • (cs) in reply to Bytecodes is not codebytes

    codebutts is not butt code:

    Btw, before you feel to much pride over your accomplishment..

    Pride? It wasn't difficult.  It just takes a little imagination.

    codebutts is not butt code:

    I posted one version with somewhat standard codestyle,

    LOL!

    codebutts is not butt code:

    so you have no reason to claim you can't code an equivalent version for the reason that the code was to obfuscated.

    Why would I claim I can't do something I have demonstrated that I did?

    codebutts is not butt code:

    What I forgot to mention in previous reply: The whole Java-thingy you posted is based on the equiality of the structure of the code I posted, which I did to make is as readable as possible, and clarily showed the goto-labels-inside-of-nested-loops issue. What if I have the iterator variables from other loops inside the if-statements?

    The code would be different and therefore the Java version would be too.

    codebutts is not butt code:

     what if the labels is not placed on equally spot in every loop? (like inside of comparison-statements?) what if the nesting was not a straightforward one-loop-inside-another approach? whould you still be confident saying "GOTO's is not neccessary, I find an equal way of coding this, and better way, just give me like.... say ... 2 months..okay?" ..

    Ever heard of 'Turing-completeness'? http://en.wikipedia.org/wiki/Turing_completeness

    "Turing completeness is significant in that every plausible design for a computing device so far advanced (even quantum computers) can be emulated by a universal Turing machine. Thus, a machine that can act as a universal Turing machine can, in principle, perform any calculation that any other computer is capable of (in other words, it is programmable). Note, however, that this says nothing about the effort to write a program for the machine or the time it may take to do the calculation."

    This is proven.  Java is Turing-complete. Therefore I am confident that any logic that you can code in C can also be coded in Java.

    codebutts is not butt code:

    Your claim: Goto's is not neccessary, there is equivalent and better ways to code everything that is using GOTO's.

    Then I can claim: Java and all other high level programming languages is unneccessary, there is equivalent and better ways to code everything in assembler or machinecode.

    Why are you using C then?  Why assember?  You should get a keyboard like this:

    http://xnet.rrc.mb.ca/uwes/E27C150/Class9/LaughALittle/default.htm

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:
    Anonymous:

    [I thought I had code that couldn't be replicated without gotos... blah blah blah.]

    As for me, my opinion is that we have gotten nowhere. I still claim GOTO's is neccessary, I want to see a Java-version that is somewhat
    equally readable and somewhat equally fast.

    You are combining two arguments that I have made separately.  Java is not slow in general.  Gotos are not strictly necessary.  I never said that all code written with gotos can be rewritten without them in Java and execute equally fast.  This is basic logic.  You need to address the points I've made, not your misrepresentation of them.

    Anonymous:

    Now I have a Java-version. The readability is quite not in the same class as my C-version,

    Do you mean that mine is actually readable?  It took me quite a while to figure out what your code was doing.  Maybe a comment or too would help.  I'd be interested to see a poll here on which version is easier to understand.

    Your version is something I would expect to see posted as a WTF here.

    Anonymous:

    I really dont know yet if the logic is the same.
    Performance-wise will my C-version outclass your Java-version, but I guess you dont believe that until you have runned a test infront of
    your own eyes, so I will not try prove it to you.

    Nothing new here, my initial thoughts about GOTO statements and about Java's inability to create equivalent code still remains.

    I posted an definition of 'equivalent' before.  I suggest you reread it.

     

    New statements to argue about. Taking the discussion to where it does not want to go. I should have known this (..and actually I did ). Posting a long post is spreading the arms and let everyone pick their subjects and hope everyone forgets what the subject of the discussion was in the beginning. Now back to the subject ( a new subject, but based on old.... like a extended class in Java):

    "Do you think GOTO's is unneccessary in logic as in my codesnippet?"

    I am interested to know, out of curiosity. Don't base your answer on previous statements or whatever have been discussed, answer from your heart. 

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:

    codebutts is not butt code:

    Btw, before you feel to much pride over your accomplishment..

    Pride? It wasn't difficult.  It just takes a little imagination.

    codebutts is not butt code:

    I posted one version with somewhat standard codestyle,

    LOL!

    codebutts is not butt code:

    so you have no reason to claim you can't code an equivalent version for the reason that the code was to obfuscated.

    Why would I claim I can't do something I have demonstrated that I did?

    codebutts is not butt code:

    What I forgot to mention in previous reply: The whole Java-thingy you posted is based on the equiality of the structure of the code I posted, which I did to make is as readable as possible, and clarily showed the goto-labels-inside-of-nested-loops issue. What if I have the iterator variables from other loops inside the if-statements?

    The code would be different and therefore the Java version would be too.

    codebutts is not butt code:

     what if the labels is not placed on equally spot in every loop? (like inside of comparison-statements?) what if the nesting was not a straightforward one-loop-inside-another approach? whould you still be confident saying "GOTO's is not neccessary, I find an equal way of coding this, and better way, just give me like.... say ... 2 months..okay?" ..

    Ever heard of 'Turing-completeness'? http://en.wikipedia.org/wiki/Turing_completeness

    "Turing completeness is significant in that every plausible design for a computing device so far advanced (even quantum computers) can be emulated by a universal Turing machine. Thus, a machine that can act as a universal Turing machine can, in principle, perform any calculation that any other computer is capable of (in other words, it is programmable). Note, however, that this says nothing about the effort to write a program for the machine or the time it may take to do the calculation."

    This is proven.  Java is Turing-complete. Therefore I am confident that any logic that you can code in C can also be coded in Java.

    codebutts is not butt code:

    Your claim: Goto's is not neccessary, there is equivalent and better ways to code everything that is using GOTO's.

    Then I can claim: Java and all other high level programming languages is unneccessary, there is equivalent and better ways to code everything in assembler or machinecode.

    Why are you using C then?  Why assember?  You should get a keyboard like this:

    http://xnet.rrc.mb.ca/uwes/E27C150/Class9/LaughALittle/default.htm

     

    Keep it up! change the subject! I am not interested in discussing all of this. I am all into GOTO's inside of nested loops right now. Btw, when you actually are here, can I ask you about your opinion about how easy/difficult it is to code logic in Java involving branches between nested loops?

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:

    Anonymous:
    The logic in my code snippet can't take advantage from multi-threading to be executed faster. More versions of the same function running in different threads is the only way, then it can be altered so the average execution-time is less. The single function is so dependent on recently used variables to continue at all. This function alone does not benefit at all being modified to a multithreaded version. Now, show me a more clean way for the same purpose using Java, C++, Perl or whatever.

    It was difficult to understand the code you have given because of all the basic rules of writing good code that you have broken here.   I wasn't sure where the return belongs so I made an educated guess.  I am sure there is a much better way to approach this problem given the requirements but I believe this gives the same basic program flow:

    I have compiled our versions and ran a simple comparison.

    Your Java version is executing about 8 times slower than my version. The logic in your version is not the same as in my, but I took that into consideration when performing the speedcomparison -> I actually measured how fast execution was travelling through code.

  • (cs) in reply to Bytecodes is not codebytes

    Anonymous:

    New statements to argue about. Taking the discussion to where it does not want to go. I should have known this (..and actually I did ). Posting a long post is spreading the arms and let everyone pick their subjects and hope everyone forgets what the subject of the discussion was in the beginning. Now back to the subject ( a new subject, but based on old.... like a extended class in Java):

    I find it quite ironic that when I post responses to your statements you accuse me of changing the subject.  This is a stupid trick and I'm not biting.  These are the tactics of somone who feels they are losing an argument.  So please try to focus on the actual discussion and cut the crap.

    Anonymous:

    "Do you think GOTO's is unneccessary in logic as in my codesnippet?"

    I am interested to know, out of curiosity. Don't base your answer on previous statements or whatever have been discussed, answer from your heart. 

    YES.  I feel the general form of your code is unecessary and is the result of a lack of skill and/or ingenuity, nothing more.  That's the answer my heart gives.  Your code is extremely abusive of define statements and gotos.  I can understand the use of gotos in certain cases but your second code snippet is completely obtuse and fragile.  Many subtle changes to the logic would be extremely difficult to implement without rewriting the entire thing.

  • (cs) in reply to Bytecodes is not codebytes

    code hose:

    Keep it up! change the subject! I am not interested in discussing all of this. I am all into GOTO's inside of nested loops right now.

    Yes, you are clearly not interested in dicussing anything that shows you to be wrong and/or ignorant.

    code hose:
    Btw, when you actually are here, can I ask you about your opinion about how easy/difficult it is to code logic in Java involving branches between nested loops?

    Once it is in the form I have given (roughly the state pattern) it's generally quite simple.  As a rule of thumb, you should avoid commenting on things of which you clearly have no knowledge or understanding.

  • (cs) in reply to Bytecodes is not codebytes

    Anonymous:

    I have compiled our versions and ran a simple comparison.

    Your Java version is executing about 8 times slower than my version. The logic in your version is not the same as in my, but I took that into consideration when performing the speedcomparison -> I actually measured how fast execution was travelling through code.

    Sounds like BS to me.  But lets assume it's true.  What version of Java?  What JVM?  What OS?  What's different about the logic?

  • (cs) in reply to dubwai

    I left out a crucial line by mistake:

        public static int function1(final int arg1)
        {
            Operation.arg1 = arg1;

  • (cs) in reply to Bytecodes is not codebytes

    Anonymous:

    I have compiled our versions and ran a simple comparison.

    Your Java version is executing about 8 times slower than my version. The logic in your version is not the same as in my, but I took that into consideration when performing the speedcomparison -> I actually measured how fast execution was travelling through code.

    I'll also need to know how you are measuring 'how fast execution was travelling through code'.

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:

    code hose:

    Keep it up! change the subject! I am not interested in discussing all of this. I am all into GOTO's inside of nested loops right now.

    Yes, you are clearly not interested in dicussing anything that shows you to be wrong and/or ignorant.

    code hose:
    Btw, when you actually are here, can I ask you about your opinion about how easy/difficult it is to code logic in Java involving branches between nested loops?

    Once it is in the form I have given (roughly the state pattern) it's generally quite simple.  As a rule of thumb, you should avoid commenting on things of which you clearly have no knowledge or understanding.

    No this was not my intention at all, all this ignoring all your nit-picking exactly everywhere was not why how you think it was. It is purely because I am in a situation where languagedifficulties and other parameters limits me in going into depth of all threads and leaves of subjects from the basic tree (don't know if you understand this, sounds alot better in my own language). But I read it all, but is impossible to reply to all. And if repling to all with my own opinion you will extend and reply multiplicating amount of subjects. But I am still were I was when we began discussing, I had my thoghts about GOTO's being neccessary, and that JAva is missing out on much not having an equivalent way to structure code, and that JAva execute that logic very poorely. I was truely hoping to see something that was contradicing that, but so far have this discussion not changed my opinion a single bit. It has only made my opinion stronger, because now a decent Java programmer can't convince me I am wrong

  • (cs) in reply to Bytecodes is not codebytes

    Anonymous:
    No this was not my intention at all, all this ignoring all your nit-picking exactly everywhere was not why how you think it was. It is purely because I am in a situation where languagedifficulties and other parameters limits me in going into depth of all threads and leaves of subjects from the basic tree (don't know if you understand this, sounds alot better in my own language). But I read it all, but is impossible to reply to all. And if repling to all with my own opinion you will extend and reply multiplicating amount of subjects. But I am still were I was when we began discussing, I had my thoghts about GOTO's being neccessary, and that JAva is missing out on much not having an equivalent way to structure code, and that JAva execute that logic very poorely. I was truely hoping to see something that was contradicing that, but so far have this discussion not changed my opinion a single bit. It has only made my opinion stronger, because now a decent Java programmer can't convince me I am wrong

    Yes, dinosaurs don't adapt to new developments in technology very well.

    I'm really no surprised given the code you present as 'good'.  People who write bad code often think they are great developers.

    Now let me ask you a question.  Has anyone else had to maintain this code?  What kind of application is it that needs to squeeze out every drop of CPU?  If speed is so crucial, why don't you hand-craft the assembly/machine code?

  • Bytecodes is not codebytes (unregistered) in reply to dubwai
    dubwai:

    Anonymous:
    No this was not my intention at all, all this ignoring all your nit-picking exactly everywhere was not why how you think it was. It is purely because I am in a situation where languagedifficulties and other parameters limits me in going into depth of all threads and leaves of subjects from the basic tree (don't know if you understand this, sounds alot better in my own language). But I read it all, but is impossible to reply to all. And if repling to all with my own opinion you will extend and reply multiplicating amount of subjects. But I am still were I was when we began discussing, I had my thoghts about GOTO's being neccessary, and that JAva is missing out on much not having an equivalent way to structure code, and that JAva execute that logic very poorely. I was truely hoping to see something that was contradicing that, but so far have this discussion not changed my opinion a single bit. It has only made my opinion stronger, because now a decent Java programmer can't convince me I am wrong

    Yes, dinosaurs don't adapt to new developments in technology very well.

    I'm really no surprised given the code you present as 'good'.  People who write bad code often think they are great developers.

    Now let me ask you a question.  Has anyone else had to maintain this code?  What kind of application is it that needs to squeeze out every drop of CPU?  If speed is so crucial, why don't you hand-craft the assembly/machine code?

    Then there must be many dinosaurs developers out there on earth then. But most of them is only dinosaurs to thoose who dont see whole picture. Take me for example. I am now using a 386 computer 32 Mb ram, sitting on a modemdial up line with a 14k4 modem in a country where we read/write from right to left using letters you probably haven't ever seen, perhaps seen but cant fit to what country. we have not english as second language, I have learned some from movies, but most from porely translated instructionalbooks/tutorials.. translated from other language to english. exactly none of relatives and friends (have alot, really, we will tight together here) knows more than say 20 waords in english. And here I try discussing with you the advantage GOTO's can have in some situations.. all this in a language I hardy know. Refreshing this forum to see if you have replied takes 10 minutes for me, I guess the line to where webb-server is located is quite long.

     

    the application is getting correct locations of data from a database.. it is actually not the original function, only an altered subroutine, the real one contains less constants in comparisons and alot more variables. to make a comparison, you actually don't think the raw power in googles search engine is written using classes and such do you?

  • (cs) in reply to Bytecodes is not codebytes

    Anonymous:
    I was truely hoping to see something that was contradicing that, but so far have this discussion not changed my opinion a single bit. It has only made my opinion stronger, because now a decent Java programmer can't convince me I am wrong

    First of all, I don't believe for a second that you were 'truly hoping to see something that was contradicing that' for a second.  You had clearly assumed it wasn't possible from the start.

    Secondly, I didn't give the best possible conversion of the code for several reasons: 1. I don't understand what the code is supposed to do because you never explained that and the code is completely obtuse. 2. I merely wanted to demonstrate that the logic coversion was possible which I believe I did. 3. I have other things to do.

    Thirdly, you've consistently attempted diversionary tactics in the discussion.  And I find that game tiresome.

    For these reasons among other things, I am done with this topic.  You don't want to open your mind to other ways of approaching problems so I'm not going to waste anymore time addressing your challenges.  I've shown what I felt the need to show.

  • (cs) in reply to Bytecodes is not codebytes
    Anonymous:

    the application is getting correct locations of data from a database.. it is actually not the original function, only an altered subroutine, the real one contains less constants in comparisons and alot more variables.

    Are you kidding?  What kind of screwed up design requies a method like that to find data in a database?  You do realize that IO to a DB is generally about 1000 times slower than local memory access.  So even if the Java code is 50 times slower, it won't matter.  You should do a wiki search on micro-optimization.  They might even have a page on it in your own language.

    Anonymous:

    to make a comparison, you actually don't think the raw power in googles search engine is written using classes and such do you?

    I think they use C++ but I'm not really sure.  Pretty much everything I've done for the last 7 years in my work has involved databases and I've never seen anything even approaching the ugliness of that for it.  Why do you need so much code to do such a simple task?

Leave a comment on “When It's OK To GOTO”

Log In or post as a guest

Replying to comment #:

« Return to Article