Details

    • Type: Task Task
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      In particular it's not clear why it resets numRead to zero in next() after it reaches 23.

        Activity

        Hide
        Keith Turner added a comment -

        Updates to numRead are not thread-safe. Is that not a concern here?

        Right, its not. Its not a concern. Its not expected that multiple threads would be reading from the same iterator.

        Show
        Keith Turner added a comment - Updates to numRead are not thread-safe. Is that not a concern here? Right, its not. Its not a concern. Its not expected that multiple threads would be reading from the same iterator.
        Hide
        Vikram Srivastava added a comment -

        Thanks for the explanation Keith Turner. Updates to numRead are not thread-safe. Is that not a concern here?

        Show
        Vikram Srivastava added a comment - Thanks for the explanation Keith Turner . Updates to numRead are not thread-safe. Is that not a concern here?
        Hide
        Keith Turner added a comment -

        I have seen measurable performance impacts when accessing AtomicLongs too often. I think in this case I was trying to avoid this. Incrementing the non-volatile can possibly be done in cache or in a register. Incrementing the volitale has to go to main memory and may cause a cache flush.

        I think I just pulled 23 out of thin air, not sure if its too low. I don't think I did performance testing to pick the number.

        Show
        Keith Turner added a comment - I have seen measurable performance impacts when accessing AtomicLongs too often. I think in this case I was trying to avoid this. Incrementing the non-volatile can possibly be done in cache or in a register. Incrementing the volitale has to go to main memory and may cause a cache flush. I think I just pulled 23 out of thin air, not sure if its too low. I don't think I did performance testing to pick the number.
        Vikram Srivastava created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Vikram Srivastava
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development