Google Groups Home
Help | Sign in
Message from discussion Performance characteristics of mutable static primitives?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
John Wilson  
View profile
 More options Apr 2, 6:36 am
From: "John Wilson" <tugwil...@gmail.com>
Date: Wed, 2 Apr 2008 11:36:14 +0100
Local: Wed, Apr 2 2008 6:36 am
Subject: Re: [jvm-l] Re: Performance characteristics of mutable static primitives?
On 4/2/08, Charles Oliver Nutter <charles.nut...@sun.com> wrote:

>  John Wilson wrote:
>  > That is rather odd.

>  > Shouldn't count be volatile?

>  > If it's declared as volatile does that make any difference?

> I had not tried it because I expected volatile would only make it
>  slower. And in this case, the code in question didn't really care about
>  perfect accuracy for the counter since it's just a rough guide. But
>  here's numbers with volatile on my machine:

Interesting. I thought that the runtime system might have inferred
that count should have been volatile but you numbers show that this is
not the case.
[snip]

>  I tried another non-volatile run using i += 1 rather than i++ and the
>  numbers were almost identical, with Java 6 severely degrading with
>  multiple threads running and Java 5 improving.

It would be interesting to try:

tmp = i;
tmp++;
i = tmp;

for tmp as a local variable and again for tmp as a public instance field.

(I'm sorry I can't do the tests for mystelf as I don't have access to
a muti core machine here).

John Wilson


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google