Hi, In modern JVM it's useless because it remove dead code.
This technique is use in C/C++ in mechanical sympathy (to be friendly with cpu cache to avoid to much context switch in it) Antonio 2015-01-26 21:16 GMT+01:00 Philippe Mouawad <[email protected]>: > Hi, > Thanks for infos. > > By the way I noticed netty had a variation of this class in their code > which inits seed differently. > > Regards > > > > On Mon, Jan 26, 2015 at 7:28 AM, Felix Schumacher < > [email protected]> wrote: > > > > > > > Hi Phillipe. > > > > Am 25. Januar 2015 22:42:27 MEZ, schrieb Philippe Mouawad < > > [email protected]>: > > >Hi Felix, > > >Reverted , can you explain to me this ? I don't see these fields used, > > >are > > >they through reflection ? > > > > They are not used. Neither directly nor indirectly. They are used as > > padding to prevent cache issues on hardware level. You will find more > > information when you search the Internet for "ThreadLocalRandom padding". > > > > It might be, that we don't need the padding on modern jvms, but if we > > assumed to have those, we would not need the copy of the class either :) > > > > That is why I opt for keeping the "useless" variables. > > > > Regards > > Felix > > > > > >Thanks > > > > > >On Sun, Jan 25, 2015 at 10:30 PM, Felix Schumacher < > > >[email protected]> wrote: > > > > > >> > > >> > > >> Am 25. Januar 2015 21:35:48 MEZ, schrieb [email protected]: > > >> >Author: pmouawad > > >> >Date: Sun Jan 25 20:35:48 2015 > > >> >New Revision: 1654701 > > >> > > > >> >URL: http://svn.apache.org/r1654701 > > >> >Log: > > >> >Remove unused fields > > >> > > > >> >Modified: > > >> > > > >jmeter/trunk/src/core/org/apache/jmeter/util/ThreadLocalRandom.java > > >> > > > >> >Modified: > > >> >jmeter/trunk/src/core/org/apache/jmeter/util/ThreadLocalRandom.java > > >> >URL: > > >> > > > >> > > > > > > http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/ThreadLocalRandom.java?rev=1654701&r1=1654700&r2=1654701&view=diff > > >> > > >> > > > > > >>============================================================================== > > >> >--- > > >jmeter/trunk/src/core/org/apache/jmeter/util/ThreadLocalRandom.java > > >> >(original) > > >> >+++ > > >jmeter/trunk/src/core/org/apache/jmeter/util/ThreadLocalRandom.java > > >> >Sun Jan 25 20:35:48 2015 > > >> >@@ -54,11 +54,6 @@ public class ThreadLocalRandom extends R > > >> > */ > > >> > boolean initialized; > > >> > > > >> >- // Padding to help avoid memory contention among seed updates > > >in > > >> >- // different TLRs in the common case that they are located near > > >> >- // each other. > > >> >- private long pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7; > > >> > > >> Given the comment above the fields, I would not remove those padding > > >> fields. > > >> > > >> Regards > > >> Felix > > >> >- > > >> > /** > > >> > * The actual ThreadLocal > > >> > */ > > >> > > >> > > > > > > > -- > Cordialement. > Philippe Mouawad. >
