EPollArrayWrapper.release should be O(N), not O(N^2)

Alan Bateman Alan.Bateman at Sun.COM
Wed Nov 4 00:56:52 PST 2009


Martin Buchholz wrote:
> Hi Alan,
>
> This is a bug report with fix.  Please review.
>
> webrev:
> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/EPollArrayWrapper.release/ 
> <http://cr.openjdk.java.net/%7Emartin/webrevs/openjdk7/EPollArrayWrapper.release/>
>
> Synopsis: EPollArrayWrapper.release should be O(N), not O(N^2)
> Description:
> In a recent email, I said
>
> "no one is really using LinkedList
> in performance-sensitive production code, eh?"
>
> That's completely false, of course.
Thanks (Igor) for finding this. It slipped in with the changes for the 
complex issue that is 6693490. That fix isn't in any of Sun's production 
releases yet so that may, at least partially, explain why we haven't 
seen this before. Also, the pending update list isn't usually too long 
(depends on how the Selector is used of course) so it is possible this 
performance issue could have lurked for a long time.

The short-term fix looks good to me and I've created this bug:
  6897993: (se) Close or cancel performance issue when number of pending 
updates is high (lnx)

I'll also look to replace the list in milestone 6 as the close/cancel 
shouldn't be O(N).

The test case looks very useful - maybe we should rename it to 
LotsOfCancels to be consistent with the naming of the other LotsOf* 
tests. I don't think it would be easy to turn this into a reliable jtreg 
test but I'd like to see it in the test suite for manual usage - I think 
you've done that in other places too.

-Alan.





More information about the nio-dev mailing list