On Friday, 21 August 2015 at 12:45:52 UTC, Kagamin wrote:
On Thursday, 20 August 2015 at 15:31:13 UTC, tony288 wrote:
So I wrong some code. But it seems the time to process a
shared struct & shared long is always the same. Regardless of
adding paddings.
Should it be different?
Hi
all thanks, I guess there is a subtopic going on now. But I
rewrote the code so that D & Java looks fairly similar.
First my mistake is I divided Nanosecond with too many zeros to
get ms and hence Java seemed far superior and hence my
frustration.
That corrected D looked better - but I feel it is a bad
comparison anyways different language etc... So won't say 1 is
faster than the other.
What I do find interesting is really now going back to the
padding and false sharing.
If I take the code here
http://mechanical-sympathy.blogspot.co.uk/2011/07/false-sharing.html edit it
as I mentioned above.
The extra Padding Does affect quite a bit Java. However with D,
not so much. So was curious if something is happening in the
compiler. I remember I read a thread on this community about
alignAllocate .... but couldn't really follow the post.
So back to shared.. If Shared should be considered a "normal"
accessible my multiple threads. Should I put this in somekind of
lock/mutex/semaphore?