Thread: Why doesn't Jagex use Bitwise OR for their buffers?

Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 39
  1. #21  
    Registered Member
    Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,436
    Thanks
    166
    Thanked 483 Times in 190 Posts
    Rep Power
    386
    Quote Originally Posted by iKilem View Post
    I disagree with the statement "it's faster most of the time" because it depends on the platform. If in practice it does turn out to be the case, then it's correct in that sense, sure. Benchmarks aren't really relevant to what I'm saying. Whether java.nio.ByteBuffer uses OR depends on the implementation. See this: java.nio: ByteBufferHelper.java. It's used by some class ByteBufferImpl that extends ByteBuffer. It uses addition.
    Bitwise operation - Wikipedia, the free encyclopedia

    "It is a fast, primitive action directly supported by the processor, and is used to manipulate values for comparisons and calculations." ... "the latter may still be optimal for overall power/performance due to lower resource use."



    Btw you must have a different JDK because, there is no such thing as "java.nio.ByteBufferHelper" in Sun JDK, they all use java.nio.Bits lol (which uses or...)

    Found in java.nio.Bits:

    Code:
        static private int makeInt(byte b3, byte b2, byte b1, byte b0) {
            return (((b3       ) << 24) |
                    ((b2 & 0xff) << 16) |
                    ((b1 & 0xff) <<  8) |
                    ((b0 & 0xff)      ));
        }
    Reply With Quote  
     

  2. #22  
    Hei
    Hei is offline
    Ex-Moderator
    Hei's Avatar
    Join Date
    Dec 2006
    Age
    17
    Posts
    2,624
    Thanks
    937
    Thanked 615 Times in 321 Posts
    Rep Power
    2289
    Nobody said that addition is any better than OR.
    It doesn't matter which one you use, there is no impact on performance, since it's different performance on different platforms.
    So I don't see what you guys arguing about.
    Reply With Quote  
     

  3. #23  
    Registered Member
    Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,436
    Thanks
    166
    Thanked 483 Times in 190 Posts
    Rep Power
    386
    Quote Originally Posted by kLeptO View Post
    Nobody said that addition is any better than OR.
    It doesn't matter which one you use, there is no impact on performance, since it's different performance on different platforms.
    So I don't see what you guys arguing about.
    why are you people so arrogant to use addition? i really could care less if you use OR or addition. OR has 2 advantages over addition, addition has NONE. there are no advantages of using addition over OR, only possibility for disadvantage.

    there is never going to be better performance with addition unless the processor is specifically built for it

    Advantages of using OR:

    1. Possibly much much faster, but in new processors it might just be a little bit faster
    2. Less power consumption! (LESS CIRCUITRY!!!)

    Advantages of using Add:

    NONE!


    In fact using addition in these kinds of situations is just dumb because it makes it more difficult to remove and manage bits.

    I found a nice discussion for you, scroll to the second post: best practices - Bitwise-OR vs Adding Flags - Programmers - Stack Exchange

    @a previous post by iKilem: actually x86 instructions have a lot in common with Java bytecode..incase you didn't know...btw ever heard of JIT?

    Now would all PLEASE stop arguing for this, there is no reason to! there is NO advantage of using ADDITION rather than OR, unless you are dumb and don't know how OR works lol (so you wouldn't think to use it or know how...)

    UNLESS YOU HAVE SOMETHING INTELLIGENT TO SAY AND HAVE EVIDENCE TO BACK IT UP DON'T POST BECAUSE I WILL NOT RESPOND ANYMORE!
    Reply With Quote  
     

  4. #24  
    Hei
    Hei is offline
    Ex-Moderator
    Hei's Avatar
    Join Date
    Dec 2006
    Age
    17
    Posts
    2,624
    Thanks
    937
    Thanked 615 Times in 321 Posts
    Rep Power
    2289
    Use what suits you, alright.

    I would use OR myself in that case, but don't compare them unless you know how stuff works on processor level.
    Now Jagex also using it for a reason, not saying that Add has any advantages over OR, just maybe they used Add in the past and cba to change it.
    Reply With Quote  
     

  5. #25  
    Registered Member

    Join Date
    Jan 2008
    Posts
    2,603
    Thanks
    488
    Thanked 588 Times in 382 Posts
    Rep Power
    884
    Quote Originally Posted by fl3x View Post
    No. It is a simpler operation, period. It will always be faster. Are you too stupid to understand that?
    Holy dick fuck, they are just different opcodes as far as Java bytecode is concerned. One isn't simpler than the other in that sense. Maybe for the processor this is the case, but as I've been saying throughout this thread, that shouldn't really concern a Java programmer (unless it's clearly something to think about, which it isn't). Are you too stupid to understand that? You and Killer 99 are just looking at it from a different perspective and are taking it way out of proportion.

    Quote Originally Posted by Killer 99 View Post
    Btw you must have a different JDK because, there is no such thing as "java.nio.ByteBufferHelper" in Sun JDK, they all use java.nio.Bits lol (which uses or...)
    It says in the source that it's from GNU Classpath.

    Quote Originally Posted by Killer 99 View Post
    Advantages of using OR:

    1. Possibly much much faster, but in new processors it might just be a little bit faster
    2. Less power consumption! (LESS CIRCUITRY!!!)
    Platform-dependant mate.

    Quote Originally Posted by Killer 99 View Post
    In fact using addition in these kinds of situations is just dumb because it makes it more difficult to remove and manage bits.

    I found a nice discussion for you, scroll to the second post: best practices - Bitwise-OR vs Adding Flags - Programmers - Stack Exchange
    That's a fair argument.

    Quote Originally Posted by Killer 99 View Post
    @a previous post by iKilem: actually x86 instructions have a lot in common with Java bytecode..incase you didn't know...btw ever heard of JIT?

    Now would all PLEASE stop arguing for this, there is no reason to! there is NO advantage of using ADDITION rather than OR, unless you are dumb and don't know how OR works lol (so you wouldn't think to use it or know how...)

    UNLESS YOU HAVE SOMETHING INTELLIGENT TO SAY AND HAVE EVIDENCE TO BACK IT UP DON'T POST BECAUSE I WILL NOT RESPOND ANYMORE!
    ... well, there are a handful of instructions that are the same in terms of functionality, but not how the processor deals with those instructions obviously, so I don't see what your point is.

    No one's saying addition is better than using OR. I'm sure I mentioned that as well.
    ~iKilem
    Reply With Quote  
     

  6. #26  
    Registered Member
    Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,436
    Thanks
    166
    Thanked 483 Times in 190 Posts
    Rep Power
    386
    Quote Originally Posted by iKilem View Post
    Holy *profound* *profound*, they are just different opcodes as far as Java bytecode is concerned. One isn't simpler than the other in that sense. Maybe for the processor this is the case, but as I've been saying throughout this thread, that shouldn't really concern a Java programmer (unless it's clearly something to think about, which it isn't). Are you too stupid to understand that? You and Killer 99 are just looking at it from a different perspective and are taking it way out of proportion.


    It says in the source that it's from GNU Classpath.


    Platform-dependant mate.


    That's a fair argument.


    ... well, there are a handful of instructions that are the same in terms of functionality, but not how the processor deals with those instructions obviously, so I don't see what your point is.

    No one's saying addition is better than using OR. I'm sure I mentioned that as well.
    you think java bytecode isn't executed in x86 instructions, what are you, stupid?

    like i said, you are using openjdk or something.

    like i said, it depends on the processor make

    .

    i gave you the advantages, now what are the advantages of using addition? that could answer the question i originally posed, so far...no one has stated or brought up any advantages of using addition..................................
    Reply With Quote  
     

  7. #27  
    Hei
    Hei is offline
    Ex-Moderator
    Hei's Avatar
    Join Date
    Dec 2006
    Age
    17
    Posts
    2,624
    Thanks
    937
    Thanked 615 Times in 321 Posts
    Rep Power
    2289
    Quote Originally Posted by Killer 99 View Post
    no one has stated or brought up any advantages of using addition..................................
    probably because it has no fucking advantages?
    Reply With Quote  
     

  8. Thankful user:


  9. #28  
    Registered Member
    Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,436
    Thanks
    166
    Thanked 483 Times in 190 Posts
    Rep Power
    386
    Quote Originally Posted by kLeptO View Post
    probably because it has no *profound* advantages?
    thanks i appreciate the support on this argument. maybe the other side will see things differently and take a step out of ignorance
    Reply With Quote  
     

  10. #29  
    Registered Member

    Join Date
    Jan 2008
    Posts
    2,603
    Thanks
    488
    Thanked 588 Times in 382 Posts
    Rep Power
    884
    Quote Originally Posted by Killer 99 View Post
    you think java bytecode isn't executed in x86 instructions, what are you, stupid?

    like i said, you are using openjdk or something.

    like i said, it depends on the processor make

    .

    i gave you the advantages, now what are the advantages of using addition? that could answer the question i originally posed, so far...no one has stated or brought up any advantages of using addition..................................
    If I'm on my smart phone which has an ARM processor, nope, there's no x86 involved.

    Like I said, it's from GNU Classpath. I never said anything about using it, though. I just linked you to something I found on the web.

    Yeah, it depends on the processor which is what I've been saying, hence why the advantages you listed aren't really relevant.

    ... how many times do I have to say I'm not recommending addition over bitwise OR? There are no advantages.
    ~iKilem
    Reply With Quote  
     

  11. Thankful user:

    Hei

  12. #30  
    Registered Member
    Killer 99's Avatar
    Join Date
    Dec 2007
    Posts
    1,436
    Thanks
    166
    Thanked 483 Times in 190 Posts
    Rep Power
    386
    Quote Originally Posted by iKilem View Post
    If I'm on my smart phone which has an ARM processor, nope, there's no x86 involved.

    Like I said, it's from GNU Classpath. I never said anything about using it, though. I just linked you to something I found on the web.

    Yeah, it depends on the processor which is what I've been saying, hence why the advantages you listed aren't really relevant.

    ... how many times do I have to say I'm not recommending addition over bitwise OR? There are no advantages.
    i don't need to prove anything to you i'm not letting you waste any more of my time. GO USE ADDITION!
    Reply With Quote  
     


Page 3 of 4 FirstFirst 1234 LastLast
Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Buffers for C I/O!
    By Cups in forum Application Development
    Replies: 9
    Last Post: 10-18-2011, 11:55 PM
  2. Bitwise opperators in java
    By Pilldom in forum Help
    Replies: 2
    Last Post: 07-20-2011, 04:55 AM
  3. Bitwise help
    By Lmctruck30 in forum Help
    Replies: 3
    Last Post: 06-26-2010, 06:02 PM
  4. My calculation of bitwise operators
    By 03data in forum Application Development
    Replies: 10
    Last Post: 05-24-2010, 07:42 PM
  5. Flipping the Stream buffers
    By Virus X3 in forum Help
    Replies: 3
    Last Post: 12-16-2009, 04:39 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •