www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.concurrency, speed, etc.

reply Adam Conner-Sax <adam_conner_sax yahoo.com> writes:
Attached (over this and the next post) are 3 D files and sample output
(compiled with "dmd -O -release -inline Queue_Tester.d Queue_Examples.d
PrettyPrint.d" on my system, OSX 10.6.6, 2x2.8GHz quad-core Xeon) from a
multi-threaded queuing test-bed.

I wrote the tester as an exercise in learning D.  The language is great;
perfect for me as someone who loved generics in C++ but found that all the
cool things you could do got ugly and messy fast.

The tester loops over a few different sorts of queues (a locking queue using a
lock in the queue/dequeue functions,a lock free queue using hazard pointers,
std.concurrency message passing) and a few different test scenarios (number of
threads, number of messages, message rates) and measures the statistics of the
latencies (I stamp the time when the message is formed and enqueued and then
when it's dequeued).

Anyway, after writing and debugging this, I'm left with some questions (note,
I imagine the answers to all these may be that I coded things wrong or badly.
I welcome that answer as long as it comes with a hint for how to do better!)

1) I couldn't get the synchronized class version (as opposed to using
synchronized statements in the functions) to run.  It would hang in odd ways.
 This may be related to a bug I reported earlier (and Sean was helpful enough
to fix!) so this may be moot.

2) Message passing is slow in my tests.  Often an order of magnitude or more
slower than the fastest (lock-free queue).  I expect to pay some price for the
convenience, etc. but that seems excessive.

3) I've built and run on windows and linux.  The windows version works fine
but the linux version seems to have some issue with the timestamping (using
systime()), often the latencies came through as 0 (and I'm using
toMicroseconds!double() so I should see any ticks at all).  Is there a known
Linux bug or issue with systime().

4) I still don't totally understand shared.  It does what I expect when
variables are static.  That's why all the queues are static objects.  But that
doesn't scale so well (I know I could set up static factories for static
objects but that seems like it shouldn't be necessary).  When I put an
unshared variable in a non-static class and then use the class from multiple
threads, the variable acts shared.  Is that a bug or a feature?

Thanks for any and all thoughts.

Adam
begin 644 Queue_Tester.d




M=&0N;6%T:#L-"FEM<&]R="!S=&0N<F%N9&]M.PT*:6UP;W)T(&-O<F4N=&AR







M975E<R$H42Y$871A7U1Y<&4I(%%4.PT*("`-"B` =F]I9"!S96YD7V1A=&$H
M:6X =6EN="!S96YD97)?:60L(&EN('5I;G0 :&]W7VUA;GDL('5I;G0 =7-?
M9&5L87DL('5I;G0 =7-?:FET=&5R+"`-" D)(%1I9"!O=VYE<E1I9"P 5&ED
M(')E8V5I=F5R5&ED*2`-"B` >PT*("` (&1E8G5G(" R*2![('=R:71E9FQN
M*")%;G1E<FEN9R!S96YD97( )7, =VET:"!U<U]D96QA>3TE<R!A;F0 =7-?
M:FET=&5R/25S(BQS96YD97)?:60L=7-?9&5L87DL=7-?:FET=&5R*3L ?0T*

M('5S:B`](&-A<W0H:6YT*75S7VII='1E<CL +R\ =6YI9F]R;2 M>"QX*2!H
M86YG<R!W:&5N('  :7, =6EN=`T*("` ("\O<F5C96EV92 H5&AR96%D<U]2
M96%D>2!T9"D >WTI.PT*("` (&9O<F5A8V H:SL ,"XN:&]W7VUA;GDI('L-
M"B` ("` (%%4+E!A8VMA9V4 <#L-"B` ("` ('`N<V5N9&5R7W-E<75E;F-E
M(#T :SL-"B` ("` ('`N<V5N9&5R7VED(#T <V5N9&5R7VED.PT*("` ("` 
M<"YP5&EM92`]('-Y<W1I;64H*3L-"B` ("` (&1E8G5G(" U*2![('=R:71E
M9FQN*")S96YD:6YG.B`E<R(L450N<&%C:V%G95]T;W-T<FEN9RAP*2D[('T-
M"B` ("` (&1E8G5G(" U*2![('=R:71E9FQN*")C86QL:6YG($5N<75E=64B
M*3L ?0T*("` ("` 42Y%;G%U975E*'`I.PT*("` ("` :68 *'5S7V1E;&%Y
M(#X ,"D >PT*"6EN="!N97AT7W-L965P7W5S(#T =7-?9&5L87D[+R\M=7-J
M*R H=7-J(#X


M("` ?0T*("` ('T-"B` ("!D96)U9R`H,BD >R!W<FET969L;B B1FEN:7-H


M;W=N97)4:60L('-D*3L-"B` ?0T*("`-"B` =F]I9"!R96-E:79E7V1A=&$H


M?0T*("` ($%R<F%Y(61O=6)L92!L871E;F-Y.PT*("` (&QA=&5N8WDN;&5N

M,#L-

M7V)E7W)E8V5I=F5D*2` >PT*("` ("` :68 *%$N1&5Q=65U92AP*2D >PT*
M"61E8G5G(" U*2![('!R:6YT9B B4F5C)V0Z("AP:W0 )6DI("4N*G-<;B(L
M<F5C96EV960L450N<&%C:V%G95]T;W-T<FEN9RAP*2D[('T-" E4:6-K<R!R


M("` (&5L<V4 >PT*"61E8G5G(" W*2![('!R:6YT9B B16UP='D 475E=64 
M*')E8R=D("5I(&]F("5I*5QN(BQR96-E:79E9"QN=6U?=&]?8F5?<F5C96EV

M('-H87)E9"!S<&%C90T*("` ('-H87)E9%]L871E;F-Y+FQE;F=T:"`](&QA
M=&5N8WDN;&5N9W1H.PT*("` (&9O<F5A8V  *&L[,"XN;&%T96YC>2YL96YG


M(BD[('T-"B` ("!296-E:79E<E]$;VYE(')D.PT*("` ('-E;F0H;W=N97)4

M5"Y086-K86=E('`L(&EN('5I;G0 <F5C96EV95]N=6UB97(L(&EN(%1I8VMS

M;&4 96QA<'-E9%]U<R`]("AR5&EM92`M('`N<%1I;64I+G1O36EC<F]S96-O






M879E<F%G95]P86-K971S7W!E<E]S(#T 87!P<SL-"B` ("!M:6-R;W-E8V]N


M879E<F%G95]P86-K971S7W!E<E]S.PT*("!U:6YT(&UI8W)O<V5C;VYD7W9A




M86EN5&ED(#T =&AI<U1I9#L-"B` ("!C;VYS="!U:6YT('1O=&%L7W!A8VME
M=', /2!T<"YH;W=?;6%N>5]S96YD97)S("H ='`N<&%C:V5T<U]P97)?<V5N

M=&  /2!T;W1A;%]P86-K971S.PT*("` (`T*("` (%$N:6YI=&EA;&EZ92 I
M.PT*("` (&1E8G5G(" U*2![('!R:6YT9B B8W)E871E9"]I;FET:6%L:7IE
M9"!1+EQN(BD[('T (`T*("` (`T*("` ('5I;G0 =7-?9&5L87D /2`P.PT*
M("` (&EF("AT<"YA=F5R86=E7W!A8VME='-?<&5R7W, /B`P*0T*("` ("` 

M<"YH;W=?;6%N>5]S96YD97)S*2]T<"YA=F5R86=E7W!A8VME='-?<&5R7W,I
M*3L-" T*("` ('5I;G0 =7-?:FET=&5R(#T ;6EN*'5S7V1E;&%Y+'1P+FUI
M8W)O<V5C;VYD7W9A<FEA8FEL:71Y*3L-" T*("` ("\O("` (%)A;F1O;2!G

M(`T*(`T*("` (&%U=&\ <E1I9"`]('-P87=N*"941BYR96-E:79E7V1A=&$L

M+G1P+FAO=U]M86YY7W-E;F1E<G,I('L-"B` ("` (&%U=&\ <U1I9"`]('-P
M87=N*"941BYS96YD7V1A=&$L:RQT<"YP86-K971S7W!E<E]S96YD97(L=7-?

M("`O+R!A;&P =&AR96%D<R!S=&%R=&5D(`T*("` ("\O(&YO=R!W86ET('5N


M*"A396YD97)?1&]N92!S9"D >R!D96)U9R`H,BD >R!W<FET969L;B B4V5N
M9&5R("5S('-E;G0 9FEN:7-H960 <VEG;F%L+B(L<V0N<V5N9&5R7VED*3L 
M?2!]*3L-"B` ("`-"B` ("!R96-E:79E*"A296-E:79E<E]$;VYE(')D*2![





M=F<L;6%X:6UU;2QM:6YI;75M+'-T9%]D978L879G7VUI;BQA=F=?;6%X.PT*

M;W5B;&5;72!L871E;F-Y7V1A=&$I(`T*>PT*("!,871E;F-Y7T%N86QY<VES
M(&QA.PT*("!L82Y.(#T ;&%T96YC>5]D871A+FQE;F=T:#L-"B`-"B` +R]S
M;W)T960 :&5R92!S;R!A;GD 875T;V-O<G)E;&%T:6]N(&%N86QY<VES(&UU





M;&4 8BD >R`-"B` ("!D;W5B;&4 <3( /2`H8BUL82YA=F<I*BAB+6QA+F%V


M/2!S<7)T*'-D+VQA+DXI.PT*("`-"B` :6YT('!C="`](&UA>"AL82Y.+S$P
M,"PQ*3L +R\ :&]W(&UA;GD :6X ,24 /R` 375S="!B92!A="!L96%S="`Q
M+ T*("!D;W5B;&5;72!S;6%L;&5S="`](&QA=&5N8WE?9&%T85LP+BYP8W1=
M.R`-"B` 9&]U8FQE6UT ;&%R9V5S="`](&QA=&5N8WE?9&%T85LH;&$N3BUP

M;6%L;&5S="DO<&-T.PT*("!L82YA=F=?;6%X(#T <F5D=6-E(2 B82MB(BDH
M,"XP+&QA<F=E<W0I+W!C=#L-"B` <F5T=7)N(&QA.PT*("`O+W!R:6YT9B B
M)2XJ<SH 879G(&QA=&5N8WD])68 =7-<;B(L42YS:&]R=%]N86UE*"DL879G


M"G9O:60 ;6%K95]B:6YN961?9&%T82AA;&EA<R!M87!?9G5N8W1I;VX]*' I

M:6YT(&)I;G,L(&EN(&1O=6)L95M=(&QA=&5N8VEE<RP <F5F($)I;E]$871A

M("AI<RAT>7!E;V8H;6%P7V9U;F-T:6]N*&QA=&5N8VEE<ULP72D /3T ;&%T
M96YC:65S6S!=*3T]8F]O;"DI("\O(&-H96-K('1H870 ;6%P7V9U;F-T:6]N
M('-I9R!I<R`B9&]U8FQE(&8H9&]U8FQE*2(-"GL-"B` 875T;R!B:6Y?=VED
M=&  /2!M87!?9G5N8W1I;VXH;&%T96YC:65S6VQA=&5N8VEE<RYL96YG=& M


M72YL969T7V5D9V4]:RIB:6Y?=VED=& [("\O(&QE9G0 961G92!O9B!B:6X-
M"B` ("!B:6YN961?;&%T96YC:65S6VM=+F-O=6YT(#T ,#L +R\ :6YI=&EA


M;&]O<BAM87!?9G5N8W1I;VXH;&%T96YC:65S6VM=*2]B:6Y?=VED=& I*3L-



M("` 9&]U8FQE($1&(#T ;F]R;2IB:6YN961?;&%T96YC:65S6VM=+F-O=6YT
M.PT*("` ($-$1B`K/2!$1CL-"B` ("!B:6YN961?;&%T96YC:65S6VM=+D-$
M1B`]($-$1CL-"B` ("!I9B`H9&5N<VET>2D-"B` ("` (&)I;FYE9%]L871E


M86UE=&5R<R!T<"D >R`-"B` 875T;R!W<FET97( /2!A<'!E;F1E<B%S=')I

M("` 9F]R;6%T=&5D5W)I=&4H=W)I=&5R+"(E<R!P<F]D=6-E<BAS*2!E86-H
M('!R;V1U8VEN9R`E<R!P86-K971S(&%T("5S('!K=',O<R`H=&]T86PI('=I
M=&  )7, =7, :FET=&5R.B(L='`N:&]W7VUA;GE?<V5N9&5R<RQT<"YP86-K
M971S7W!E<E]S96YD97(L='`N879E<F%G95]P86-K971S7W!E<E]S+'1P+FUI
M8W)O<V5C;VYD7W9A<FEA8FEL:71Y*3L-"B` 96QS90T*("` (&9O<FUA='1E
M9%=R:71E*'=R:71E<BPB)7, <')O9'5C97(H<RD 96%C:"!P<F]D=6-I;F< 
M)7, <&%C:V5T<R!A="!M87  <F%T92!W:71H(&YO(&II='1E<CHB+'1P+FAO
M=U]M86YY7W-E;F1E<G,L='`N<&%C:V5T<U]P97)?<V5N9&5R+'1P+F%V97)A
M9V5?<&%C:V5T<U]P97)?<RQT<"YM:6-R;W-E8V]N9%]V87)I86)I;&ET>2D[

M6UT =VED=&AS(#T
M86)L92!S=')I;F=;72!H9F]R;6%T<R`](%LB)7,B+"(E<R(L(B5S(BPB)7,B
M+"(E<R(L(B5S(BPB)7,B+"(E<R)=.PT*:6UM=71A8FQE('-T<FEN9UM=(&1F
M;W)M871S(#T 6R(E<R(L(B4N,V<B+"(E+C)G(BPB)2XR9R(L(B4N,F<B+"(E
M+C)G(BPB)2XR9R(L(B4N,F<B73L-" T*<W1R:6YG(')U;E]I;F9O7VAE861E
M<B I(`T*>PT*("` (`T*("!*=7-T:69Y(&1J<ULX72`]($IU<W1I9GDN4CL 
M+R\ <FEG:'0 :G5S=&EF>2!N=6UB97( :&5A9&5R<PT*("!D:G-;,%T /2!*
M=7-T:69Y+D,[("\O(&-E;G1E<B!1=65U92!H96%D97(-" T*("!R971U<FX 

M871S+")1=65U92(L(E1O="!S(BPB879G(BPB<V0B+")M:6XB+")M87 B+"(\


M;RA1*2AI;B!,871E;F-Y7T%N86QY<VES(&QA+"!I;B!D;W5B;&4 <G5N7W,I
M(`T*>PT*("!*=7-T:69Y(&1J<ULX72`]($IU<W1I9GDN4CL +R\ <FEG:'0 

M="!J=7-T:69Y(%%U975E(&YA;64-" T*("!R971U<FX 1F]R;6%T=&5D4')I

M;E]S+&QA+F%V9RQL82YS=&1?9&5V+&QA+FUI;FEM=6TL;&$N;6%X:6UU;2QL

M8V]R871E(&QI<W0 ;V8 475E=64 ;F%M97, 86YD(&UA:V4 :6YT;R!4>7!E
M5'5P;&4 9F]R(&QO;W!I;F<-"G-T<FEN9R!M86ME475E=654>7!E5'5P;&4H
M:6X <W1R:6YG6UT 475E=65?5'EP97,I(`T*>PT*("!S=')I;F< <F5S=6QT
M(#T (F%L:6%S(%1Y<&54=7!L92$H(CL-"B` 9F]R96%C:"`H:SL ,"XN475E




M(&1O=6)L95LQ,%T ;G5M8F5R<SL-"B` 8VAA<ELQ,%T 9FEE;&0Q.PT*("!C


M(`T*("`O+R!D871A('!A8VMA9V5S('1O('1E<W0-"B` 86QI87, 5'EP951U
M<&QE(2AS;6%L;%]M97-S86=E*2!086-K86=E7U1Y<&5S.PT*(`T*("!I;6UU

M95]D871A7V9I;&5S(#T
M"B` :6UM=71A8FQE('-T<FEN9UM=('%U975E7W1Y<&5S(#T 6PT*"0D)"2` 


M("` ("` ("` ("` ("` ("` ("` ("` ("` ("` ("))4WEN8U],3%]&249/
M7T9,(BP-"B` ("` ("` ("` ("` ("` ("` ("` ("` ("` ("` ("` (")&
M249/7TQI;FME9$QI<W1?3&]C:T9R965?475E=64B+`T*("` ("` ("` ("` 


M47, /2!Q=65U95]T>7!E<RYL96YG=& [("`O+R!T:&ES(&ES(&%N;F]Y:6YG
M('-I;F-E(&ET(&YE961S('1O(&)E('-Y;F-E9"!W:71H('1H92!A8F]V92X 














M="YF:6QE+&YU;&PI.R`O+R!U;F)U9F9E<B!S=&1O=70 <V\ =V4 <V5E(&]U

M<R!I;B!M:6-R;W-E8V]N9', =6YL97-S(&]T:&5R=VES92!S<&5C:69I960N

M(&]V97( 9F%S=&5S="!A;F0 <VQO=V5S="`Q)24 <F5S<&5C=&EV96QY+B(I

M7W1H<F]U9V  /2!T<G5E.PT*("!F;W)E86-H("AP86-K86=E7W1Y<&4[(%!A
M8VMA9V5?5'EP97,I('L-"B` ("!A;&EA<R!1=65U97,A*'!A8VMA9V5?='EP


M=&4 ;&5G96YD(`T*("` (&EF("AF:7)S=%]T:6UE7W1H<F]U9V I('L-"B` 
M("` (&9O<F5A8V  *'%U975E7W1Y<&4[(%%U975E7U1Y<&5S*0T*"7=R:71E
M9FQN*"(E<R`]("5S(BQQ=65U95]T>7!E+G-H;W)T7VYA;64L<75E=65?='EP

M"B` ("` (&9I<G-T7W1I;65?=&AR;W5G:"`](&9A;'-E.PT*("` ('T-" T*

M("` 9F]R;6%T=&5D5W)I=&4H<&MG7V1E<V,L(D1A=&$ <&%C:V%G92!I<R!D
M=6UM>2!P87EL;V%D+"!A('1I;65S=&%M<"P <V5N9&5R($E$(&%N9"!S97%U
M96YC92`C+B` 4&%Y;&]A9"!I<R`E<R`H4&%C:V5T('-I>F4])7, 8GET97,I
M+EQN(BQP86-K86=E7W1Y<&4N<W1R:6YG;V8L450N4&%C:V%G92YS:7IE;V8I

M("` :6YT('1E<W1?;G5M8F5R(#T ,3L-"B` ("!F;W)E86-H("AT<#L =&5S
M=',I('L-"B` ("` ('=R:71E9FQN*"(E<UQN(BQT97-T7VEN9F\H='`I*3L-
M"B` ("` ('=R:71E9FQN*"(E<R(L<G5N7VEN9F]?:&5A9&5R*"DI.PT*(`T*



M=%]T:6UE(#T <WES=&EM92 I.PT*"6%U=&\ ;&%T96YC:65S(#T 451&+G)U
M;E]T97-T*'1P*3L-" EA=71O(&5N9%]T:6UE(#T <WES=&EM92 I.PT*"61O
M=6)L92!R=6Y?<R`]("AE;F1?=&EM92`M('-T87)T7W1I;64I+G1O4V5C;VYD
M<R%D;W5B;&4H*3L-" T*"6%U=&\ ;&$ /2!A;F%L>7IE7VQA=&5N8VEE<RAL

M=')I;F< =&5S=%]O=71P=71?9FEL92`](")4(B!^('1E>'0H=&5S=%]N=6UB
M97(I('X (E]1(B!^('1E>'0H<75E=65?;G5M8F5R*2!^("(N9&%T(CL-" D 
M(&%U=&\ 9&%T7V8 /2!&:6QE*'1E<W1?;W5T<'5T7V9I;&4L(G<B*3L-" D 
M(&1A=%]F+G=R:71E9FQN*"(C("5S(BQP:V=?9&5S8RYD871A*3L-" D (&1A
M=%]F+G=R:71E9FQN*"(C("5S(BQT97-T7VEN9F\H='`I*3L-" D (&1A=%]F
M+G=R:71E9FQN*"(C("5S(BQQ=65U95]T>7!E+F1E<V-R:7!T:6]N*3L-" D 
M(&1A=%]F+G=R:71E9FQN*"(C=F%L7'1F<F%C=&EO;EQT0T1&(BD["0T*"2` 

M*2AQ=65U95]N=6UB97(L8FEN<U]F;W)?;W5T<'5T+"!L871E;F-I97,L(&)I


M)7-<="5S(BP-" D)"2` (&)I;FYE9%]L871E;F-I97-;:UTN;&5F=%]E9&=E
M+`T*"0D)("` 8FEN;F5D7VQA=&5N8VEE<UMK72YC;W5N="P-" D)"2` (&)I



M7VYU;6)E<BLK.PT*("` ("` =W)I=&5F;&XH(B(I.PT*("` ('T-"B` ?0T*
!?0``
`
end
begin 644 Queue_Examples.d
M:6UP;W)T('-T9"YC;VYC=7)R96YC>3L-"FEM<&]R="!S=&0N9&%T971I;64[



M8W0 4&%C:V%G92`-"B` >PT*("` ('5I;G0 <V5N9&5R7VED.PT*("` ('5I
M;G0 <V5N9&5R7W-E<75E;F-E.PT*("` (%1I8VMS('!4:6UE.PT*("` (%0 




M<W1A=&EC(%1I9"!R96-E:79E<E]4:60[("\O($Y".B!T:&ES(&ES('!E<B!T
M:')E860 <V\ ;75S="!B92!S970 ;VX *F5A8V J('-E;F1I;F< =&AR96%D

M*%1I9"!T*2![(')E8V5I=F5R7U1I9"`]('0[('T-"B` ("!A;&EA<R!4($1A
M=&%?5'EP93L +R\ <V\ =&AA="!G:79E;B!A(%%U975E('=E(&-A;B!R96%C


M("` ('-T871I8R!S=')I;F< <VAO<G1?;F%M92 I('L <F5T=7)N(")402([
M('T-"B` ("!S=&%T:6, <W1R:6YG(&1E<V-R:7!T:6]N*"D >R!R971U<FX 

M9"!I;FET:6%L:7IE*"D >WT-"B` ("!S=&%T:6, =F]I9"!&<F5E3F]D92AS
M:&%R960 4$YO9&4 <"D >WT-"B` ("!S=&%T:6, <VAA<F5D*%!.;V1E*2!'


M<F]N:7IE(&)E8R!T:&4 =7-E<B!I<R!S>6YC:')O;FEZ960 (`T*("!P<FEV
M871E(&-L87-S($9R965,:7-T7T%L;&]C871O<B`-"B` >PT*("!P<FEV871E
M. T*("` ('-T871I8R!S:&%R960 4$YO9&4 :&5A9#L-"B` ("`-"B` <'5B
M;&EC. T*("` ('-T871I8R!S=')I;F< <VAO<G1?;F%M92 I('L <F5T=7)N
M(")&3"([('T-"B` ("!S=&%T:6, <W1R:6YG(&1E<V-R:7!T:6]N*"D >R!R
M971U<FX (E)E8WEC;&4 =7-E9"!N;V1E<R!V:6$ 9G)E96QI<W0N(CL ?0T*
M("` ('-H87)E9"!S=&%T:6, =&AI<R I('L :&5A9"`](&YE=R!S:&%R960H




M(BD[('T-"B` ("` (&XN;F5X="`](&AE860N;F5X=#L-"B` ("` (&AE860N

M9&4I($=E=$YO9&4H*2!S:&%R960 >PT*("` ("` 9&5B=6<H-2D >R!W<FET

M8V5S<RD >R!D96)U9R U*2![('=R:71E9FQN*")'971.;V1E(%-U8V-E9&1E
M9" I(BD[('T ?0T*("` ("` 875T;R!N(#T :&5A9"YN97AT.PT*("` ("` 
M:68 *&X :7, ;G5L;"D-"B` ("` ("` <F5T=7)N(&YE=R!S:&%R960H4$YO
M9&4I.PT*("` ("` :&5A9"YN97AT(#T ;BYN97AT.PT*("` ("` ;BYN97AT
M(#T ;G5L;#L-"B` ("` (')E='5R;B!N.PT*("` ('T-"B` ?0T*("`-"B` 
M<')I=F%T92!C;&%S<R!,;V-K:6YG7T9R965,:7-T7T%L;&]C871O<B`-"B` 
M>PT*("!P<FEV871E. T*("` ('-T871I8R!S:&%R960 4$YO9&4 :&5A9#L-
M"B` ("!S=&%T:6, <VAA<F5D($]B:F5C="!L;V-K7V]B:CL-"B` <'5B;&EC
M.B` ("`-"B` ("!S=&%T:6, <W1R:6YG('-H;W)T7VYA;64H*2![(')E='5R

M<F5T=7)N(")296-Y8VQE('5S960 ;F]D97, =FEA(&9R965L:7-T+B([('T-
M"B` ("`-"B` ("!S:&%R960 <W1A=&EC('1H:7,H*2![(`T*("` ("` :&5A
M9"`](&YE=R!S:&%R960H4$YO9&4I.R`-"B` ("` (&QO8VM?;V)J(#T ;F5W
M('-H87)E9"A/8FIE8W0I.R` ("` (`T*("` ('T-"B` ("`-"B` ("!S=&%T

M:7IE9"AL;V-K7V]B:BD >PT*("` ("` ("!H96%D(#T ;F5W('-H87)E9"A0
M3F]D92D[(`T*("` ("` ?0T*("` ('T-"B` ("`-"B` ("`-"B` ("!S=&%T
M:6, =F]I9"!&<F5E3F]D92AS:&%R960 4$YO9&4 ;BD <VAA<F5D('L-"B` 

M*3L ?0T*("` ("` <WEN8VAR;VYI>F5D("AL;V-K7V]B:BD >PT*("` ("` 


M9&4I($=E=$YO9&4H*2!S:&%R960 >PT*("` ("` 9&5B=6<H-2D >R!W<FET

M8V5S<RD >R!D96)U9R U*2![('=R:71E9FQN*")'971.;V1E(%-U8V-E9&1E

M("` ('-Y;F-H<F]N:7IE9"`H;&]C:U]O8FHI('L-"B` ("` ("` ;B`](&AE
M860N;F5X=#L-"B` ("` ("` :68 *&X :7, ;G5L;"D-"B` ("` ("` ("!R

M(&XN;F5X=#L-

M960 8VQA<W, 0U-Y;F-?3$Q?1DE&3RA!;&QO8RD-"B` >R` ("`-"B` ("!M

M("` <W1A=&EC('-H87)E9"!03F]D92!H96%D+"!T86EL.R`O+R!G;&]B86P-
M"B` <'5B;&EC. T*("` ('-T871I8R!V;VED(&EN:71I86QI>F4H*2![(`T*
M("` ("` 06QL;V,N:6YI=&EA;&EZ92 I.PT*("` ("` :&5A9"`]('1A:6P 
M/2!!;&QO8RY'971.;V1E*"D[(`T*("` ('T-"B` ("`-"B` ("!S=&%T:6, 
M<W1R:6YG('-H;W)T7VYA;64H*2![(')E='5R;B`B4T,L3$PL1BPB('X 06QL
M;V,N<VAO<G1?;F%M93L ?0T*("` ('-T871I8R!S=')I;F< 9&5S8W)I<'1I
M;VXH*2![(')E='5R;B`B4WEN8VAR;VYI>F5D(&-L87-S+"!,:6YK960 3&ES
M="!3=&]R86=E+"!&249/+"`B('X 06QL;V,N9&5S8W)I<'1I;VX[('T-"B` 
M("`-"B` ("`-"B` ("!S=&%T:6, =F]I9"!%;G%U975E*%!A8VMA9V4 <"D 

M;&XH(D5N=&5R:6YG($-3>6YC7TQ,7T9)1D]?1DPN16YQ=65U92 I(BD[('T-

M:V< /2!P.PT*("` ("` :&5A9"YN97AT(#T

M(%!A8VMA9V4 <"D +R\ <&]P8F%C:PT*("` ('L-"B` ("` (&EF("AH96%D


M<"`]('1M<"YN97AT+G!K9SL-"B` ("` ($%L;&]C+D9R965.;V1E*'1M<"D[

M4WEN8U],3%]&249/(2A4<FEV:6%L7T%L;&]C871O<BD 0U-Y;F-?3$Q?1DE&
M3U]403L-"B` 86QI87, 0U-Y;F-?3$Q?1DE&3R$H1G)E94QI<W1?06QL;V-A



M92!T86EL+"!H96%D.R`O+R!G;&]B86P-"B` ("!S=&%T:6, <VAA<F5D($]B
M:F5C="!L;V-K7V]B:CL-"B` ("!S:&%R960 <W1A=&EC('1H:7,H*2`-"B` 


M>R`-"B` ("` ($%L;&]C+FEN:71I86QI>F4H*3L-"B` ("` (&AE860 /2!T
M86EL(#T
M=&EC('-T<FEN9R!S:&]R=%]N86UE*"D >R!R971U<FX (DE3+$Q,+$8L(B!^
M($%L;&]C+G-H;W)T7VYA;64[('T-"B` ("!S=&%T:6, <W1R:6YG(&1E<V-R
M:7!T:6]N*"D >R!R971U<FX (DEN=&5R;F%L;'D 4WEN8VAR;VYI>F5D+"!,
M:6YK960 3&ES="!3=&]R86=E+"!&249/+"`B('X 06QL;V,N9&5S8W)I<'1I
M;VX[('T-"B` ("`-"B` ("`-"B` ("!S=&%T:6, =F]I9"!%;G%U975E*%!A

M('L =W)I=&5F;&XH(D5N=&5R:6YG($E3>6YC7TQ,7T9)1D]?1DPN16YQ=65U
M92 I(BD[('T-" T*("` ("` 875T;R!P;B`]($%L;&]C+D=E=$YO9&4H*3L-


M(#T
M($1E<75E=64H;W5T(%!A8VMA9V4 <"D +R\ <&]P8F%C:PT*("` ('L-"B` 
M("` (&1E8G5G(" W*2![('=R:71E9FQN*")%;G1E<FEN9R!)4WEN8U],3%]&


M("` ("` (&EF("AH96%D(&ES('1A:6PI(`T*("` ("` ("` (')E='5R;B!F
M86QS93L-"B` ("` ("` =&UP(#T =&%I;#L-"B` ("` ("` =&%I;"`]('1A
M:6PN;F5X=#L-"B` ("` ("` <"`]('1M<"YN97AT+G!K9SL-"B` ("` ('T-


M:6%L7T%L;&]C871O<BD 25-Y;F-?3$Q?1DE&3U]403L-"B` 86QI87, 25-Y
M;F-?3$Q?1DE&3R$H3&]C:VEN9U]&<F5E3&ES=%]!;&QO8V%T;W(I($E3>6YC

M95]&<F5E3&ES="`-"B` >PT*("!P<FEV871E. T*("` ('-T871I8R!S:&%R
M960 4$YO9&4 :&5A9#L-"B` ("`-"B` <'5B;&EC. T*("` ('-H87)E9"!S


M('L-"B` ("` (`T*("` ("` 9&5B=6<H-2D >R!P<FEN=&8H(D9R965.;V1E
M($-A;&QE9" I7&XB*3L ?0T*("` ("` <V-O<&4 *'-U8V-E<W,I('L 9&5B
M=6<H-2D >R!P<FEN=&8H(D9R965.;V1E(%-U8V-E9&1E9" I7&XB*3L ?2!]

M("` ('T =VAI;&4 *"%C87,H)FAE860N;F5X="QN+FYE>'0L;BDI.R`-"B` 

M('L-"B` ("` (`T*("` ("` 9&5B=6<H-2D >R!P<FEN=&8H(D=E=$YO9&4 

M9R U*2![('!R:6YT9B B1V5T3F]D92!3=6-C961D960H*5QN(BD[('T ?0T*


M("` <F5T=7)N(&YE=R!S:&%R960H4$YO9&4I.PT*("` ("` ?2!W:&EL92`H


M<R!(4%)E8U1Y<&4 >R`-"B` <'5B;&EC. T*("` (&EM;75T86)L92!I;G0 



M;`T*("` ('-H87)E9"!S=&%T:6, :6YT(&QI<W1,96Y?(#T ,#L +R\ 9VQO


M960 2%!296-4>7!E(&YE>'1?.PT*("` ('-H87)E9"!I;G0 86-T:79E7SL 

M7SL-"B` ("`-" T*("` ('-T871I8R!S:&%R960H2%!296-4>7!E*2!H96%D

M*"D >R!R971U<FX ;&ES=$QE;E\[('T-"B` ("!S=&%T:6, :6YT(%(H*2![
M(')E='5R;B!27SL ?2`-"B` ("!S=&%T:6, =F]I9"!S9712*&EN="!R*2![
M(%)?(#T <CL ?2`-" T*("` ('-T871I8R!S:&%R960H2%!296-4>7!E*2!!

M;&XH(BT^2%!296-4>7!E+D%C<75I<F4H*2(I.PT*("` ("` ?0T*("` ("` 

M87)E9"A(4%)E8U1Y<&4I('` /2!H96%D7SL-"B` ("` (&9O<B`H.R`H<"`A
M:7, ;G5L;"D .R!P(#T <"YN97AT7RD >PT*("` ("` ("!I9B`H<"YA8W1I

M9R`H-RD >R!W<FET969L;B B06-Q=6ER960 ;VQD(&AP($` )7,N(BQC87-T

M;W0 86-T:79E(&%N9"!T:&5N(&-A<R!S=6-C965D960 ;6%R:VEN9R!I="!A

M8U1Y<&4N06-Q=6ER92 I.B!C86YN;W0 <F5C>6-L92!A;B!(4"X ($UA:VEN




M+VQI<W1,96Y?8VAA;F=E9%\ /2!T<G5E.PT*("` ("` 9&5B=6<H-RD =W)I
M=&5F;&XH(DA04F5C5'EP92Y!8W%U:7)E*"DZ($EN8W)E;65N=&5D(&QI<W1,

M("` ("!P+F%C=&EV95\ /2`Q.R`O+R!I="=S(&EN('5S90T*("` ("` <"YH
M87IA<F1?(#T 8V%S="A03F]D92EN=6QL.PT*("` ("` <VAA<F5D*$A04F5C
M5'EP92D ;VQD.PT*("` ("` 9&\ >R`O+R!A9&0 :70 =&\ ;&ES=`T*("` 
M("` ("!O;&0 /2!H96%D7SL-"B` ("` ("` <"YN97AT7R`](&]L9#L-"B` 

M("!D96)U9R`H-RD >R!W<FET969L;B B06-Q=6ER960 ;F5W(&AP($` )7,N


M8U1Y<&4 <"D >PT*("` ("` <"YH87IA<F1?(#T 8V%S="AS:&%R960 4$YO
M9&4I;G5L;#L-

M960 :'` 0"`E<RXB+&-A<W0H8V]N<W0H=F]I9"HI*7`I.R!]("`-"B` ("!]

M87)E9"A03F]D92DI($YO9&5,:7-T.PT*("`O+V%L:6%S('-H87)E9"A.;V1E
M*2I;72!.;V1E3&ES=#L-

M4F5C5'EP95M+75M=($A03&ES=#L
M2%!296-4>7!E($A06TM=.R`O+R!O;F4 <&5R('1H<F5A9`T*("` ("` <W1A
M=&EC('1H:7,H*2![(`T*("` ("` 9F]R96%C:"AK.R`P+BY(4%)E8U1Y<&4N
M2RD 2%!;:UT /2!N97< 2%!296-4>7!E.PT*("` ("` 2%!,:7-T('X]($A0

M*B\-" T*("!P<FEV871E. T*("` (`T*("` ('-T871I8R!.;V1E3&ES="!R
M;&ES=#L



M("` ('-H87)E9"!S=&%T:6, =&AI<R I('L :&5A9"`](&YE=R!S:&%R960H


M(&1O('L-"B` ("` ("` ;B`](&AE860N;F5X=#L-"B` ("` ("` :68 *&X 

M.PT*("` ("` ?2!W:&EL92`H(6-A<R F:&5A9"YN97AT+&XL;BYN97AT*2D[

M960 ;F]D92!`("5S(BQC87-T*&-O;G-T*'9O:60J*2EN*3L-"B` ("` (&XN


M(`T*("` ('L-"B` ("` (&1E8G5G(" W*2!W<FET969L;B B1G)E94YO9&4 

M;BD[(`T*("` ("` :68 *')L:7-T+F1A=&$H*2YL96YG=&  /CT 2%!296-4
M>7!E+E(H*2D-"B` ("` ("` 4V-A;B I.PT*("` ('T-"B`-" T*('!R:79A




M("` (&XN;F5X="`](&AE860N;F5X=#L-"B` ("` ('T =VAI;&4 *"%C87,H
M)FAE860N;F5X="QN+FYE>'0L;BDI.PT*("` ('T-"B` ("`-"B` ("!S=&%T




M<"YR97-E<G9E*$A04F5C5'EP92YL:7-T3&5N*"DI.PT*("` ("` <VAA<F5D
M($A04F5C5'EP92!H(#T
M:"`A:7, ;G5L;"D >PT*("` ("` ("!S:&%R960 4$YO9&4 ;B`](& N:&%Z



M('L-"B` ("` ("` ("`-"B` ("` ("` 875T;R!A(#T 87!P96YD97(A<W1R
M:6YG.PT*("` ("` ("`-"B` ("` ("` 82YP=70H(E!R92US;W)T(&AA>F%R

M*0T*("` ("` ("` (&9O<FUA='1E9%=R:71E*&$L(B5S("(L8V%S="AC;VYS

M(`T*("` ("` ("!A+G!U=" B4')E+7-O<G0 <FQI<W0 <&]I;G1E<G,Z("(I
M.PT*("` ("` ("!F;W)E86-H("AN<#L <FQI<W0N9&%T82D-"B` ("` ("` 
M("!F;W)M871T9617<FET92AA+"(E<R`B+&-A<W0H8V]N<W0H=F]I9"`J*2EN

M?2`-"B` ("` ('T-" T*("` ("` 875T;R!O;&1?<FQI<W1?;&5N9W1H(#T 

M<#L-
M("` ("`-"B` ("` ('-T871I8R!B;V]L(%!.;V1E3&5S<T)Y3V)J96-T061D
M<F5S<RAI;B!03F]D92!A+"!I;B!03F]D92!B*0T*("` ("` >PT*"7)E='5R
M;B!C87-T*&-O;G-T*'9O:60J*2EA(#P 8V%S="AC;VYS="AV;VED*BDI8CL-

M:&5R92!S:&]U;&0 8F4 =6YN96-E<W-A<GDL(&9I>&5D(&EN(&YE>'0 =F5R
M<VEO;B!O9B!$/PT*("` ("` 4$YO9&5;72!S;W)T961?:'` /2!C87-T*%!.

M(&-A<W0H4$YO9&5;72ER;&ES="YD871A+F1U<#L-"B` ("` (`T*("` ("` 
M<V]R="$H4$YO9&5,97-S0GE/8FIE8W1!9&1R97-S*2AS;W)T961?:'`I.PT*
M("` ("` <V]R="$H4$YO9&5,97-S0GE/8FIE8W1!9&1R97-S*2AS;W)T961?

M(`T*("` ("` ("` (&%U=&\ 82`](&%P<&5N9&5R(7-T<FEN9SL-"B` ("` 
M("` ("`-"B` ("` ("` ("!A+G!U=" B4&]S="US;W)T(&AA>F%R9"!P;VEN

M"B` ("` ("` ("` (&9O<FUA='1E9%=R:71E*&$L(B5S("(L8V%S="AC;VYS
M="AV;VED("HI*6YP*3L-"B` ("` ("` ("!A+G!U=" B7&XB*3L-"B` ("` 
M("` ("`-"B` ("` ("` ("!A+G!U=" B4&]S="US;W)T(')L:7-T('!O:6YT
M97)S.B`B*3L-"B` ("` ("` ("!F;W)E86-H("AN<#L <V]R=&5D7W)L*0T*
M("` ("` ("` ("` 9F]R;6%T=&5D5W)I=&4H82PB)7, (BQC87-T*&-O;G-T
M*'9O:60 *BDI;G`I.PT*("` ("` ("` ('=R:71E9FQN*"(E<R(L82YD871A
M*3L-"B` ("` ("` ?0T*("` ("` ("`-"B` ("` ('T-" T*"0T*("` ("` 

M<W-">4]B:F5C=$%D9')E<W,I*'-O<G1E9%]R;"QS;W)T961?:'`I*0T*("` 

M"B` ("` (&9O<F5A8V  *&YP.R!S971$:69F97)E;F-E(2A03F]D94QE<W-"
M>4]B:F5C=$%D9')E<W,I*'-O<G1E9%]R;"QS;W)T961?:'`I*0T*("` ("` 

M("!R;&ES=#UT

M("` (&1E8G5G(" R*2![("` (`T*("` ("` ("!A=71O(&54:6UE(#T <WES
M=&EM92 I.PT*("` ("` ("!A=71O(&5L87!S960 /2`H951I;64 +2!S5&EM

M86EM960 /2!O;&1?<FQI<W1?;&5N9W1H("T <FQI<W0N9&%T82YL96YG=& [


M96-L86EM960 )6D ;V8 )6E<;B(L96QA<'-E9"P <F5C;&%I;65D+"!O;&1?


M;6EX:6X 26YJ96-T44)O:6QE<G!L871E.PT*("!P<FEV871E. T*("` ('-T
M871I8R!S:&%R960 4$YO9&4 9FER<W0L;&%S=#L-
M8FQI8SH-"B` ("!S=&%T:6, =F]I9"!I;FET:6%L:7IE*"D >R`-"B` ("` 
M(&9I<G-T(#T ;&%S="`]($A03$9?1G)E94QI<W0N1V5T3F]D92 I.R`-"B` 

M*3L ?0T*("` ("` ("`-"B` ("!S=&%T:6, <W1R:6YG('-H;W)T7VYA;64H
M*2![(')E='5R;B`B1BQ,3"Q,1B([('T-"B` ("!S=&%T:6, <W1R:6YG(&1E
M<V-R:7!T:6]N*"D >R!R971U<FX (D9)1D\Z($QO8VL 1G)E92`H=7-I;F< 
M8V%S("8 2%!S*2P =7-I;F< 82!L:6YK960 ;&ES="!A<R!S=&]R86=E+B([
M('T-"B` ("`-"B` ("`-"B` ("!S=&%T:6, =F]I9"!%;G%U975E*&EN(%!A

M<FET969L;B B16YT97)I;F< 1DE&3U],:6YK961,:7-T7TQO8VM&<F5E7U%U

M('=R:71E9FQN*")3=6-C965D960 1DE&3U],:6YK961,:7-T7TQO8VM&<F5E

M("!S:&%R960 2%!296-4>7!E(&AP(#T 2%!296-4>7!E+D%C<75I<F4H*3L-
M"B` ("` ('-C;W!E("AE>&ET*2![($A04F5C5'EP92Y296QE87-E*&AP*3L 


M+R\ 9V5T(&$ ;F5W(&]R(')E8VQA:6UE9"!O;F4-"B` ("` (&XN<&MG(#T 
M<#L-"B` ("` (`T*("` ("` 8F]O;"!U<&1A=&5D3F5W3&EN:R`](&9A;'-E
M.PT*("` ("` =VAI;&4 *"%U<&1A=&5D3F5W3&EN:RD >PT*("` ("` ("!D
M96)U9R`H-RD =W)I=&5F;&XH(FEN(&QO;W`B*3L-"B` ("` ("` ;VQD3&%S

M<F]T96-T(&]L9$QA<W0-"B` ("` ("` :68 *&QA<W0 (6ES(&]L9$QA<W0I
M(&-O;G1I;G5E.PT*("` ("` ("!D96)U9R`H-RD =W)I=&5F;&XH(FAP(&%T

M("` ("` (&EF("AL87-T(&ES(&]L9$QA<W0I('L ("\O('-T:6QL(&-O;G-I


M("` ("` ('5P9&%T961.97=,:6YK(#T 8V%S*"9L87-T+FYE>'0L8V%S="A0
M3F]D92EN=6QL+&XI.R`O+R!Y97,N("!4:&5N('1R>2!T;R!A9&0 ;F5W(&YO

M(F%T('1A:6PL(&%D9&5D(&YE=R!N;V1E+B!L87-T/25S.R!L87-T+FYE>'0]
M)7,[(&XN;F5X=#TE<R(L8V%S="AC;VYS="AV;VED*BDI;&%S="QC87-T*&-O
M;G-T*'9O:60J*2EL87-T+FYE>'0L8V%S="AC;VYS="AV;VED*BDI;BYN97AT
M*2`Z('=R:71E9FQN*")A="!T86EL+"!F86EL960 =&\ ;F5W(&YO9&4N(BD[

M("` (&%U=&\ 9FEX960 /2!C87,H)FQA<W0L;VQD3&%S="QO;&1.97AT*3L 
M+R\ ;F\N(&QA9V=I;F< =&%I;"P =')Y('1O(&9I>`T*("` ("` ("` ("` 

M;"X ;&%S=#TE<R`H=V%S("5S*2P ;&%S="YN97AT/25S(BQC87-T*&-O;G-T
M*'9O:60J*2EL87-T+&-A<W0H8V]N<W0H=F]I9"HI*6]L9$QA<W0L8V%S="AC
M;VYS="AV;VED("HI*6QA<W0N;F5X="D .B!W<FET969L;B B1F%I;&5D('1O

M"B` ("` ('T-"B` ("` (&%U=&\ =7!D871E9%]L87-T(#T 8V%S*"9L87-T
M+&]L9$QA<W0L;BD[("\O('-U8V-E<W,A($YO=RP =')Y('1O('5P9&%T92!L
M87-T+"!I9B!W92!F86EL+"!N97AT('!R;V1U8V4H*2!W:6QL(&9I>`T*("` 

M(&QA<W0N(&QA<W0])7,B+&-A<W0H8V]N<W0H=F]I9"HI*6QA<W0I(#H =W)I



M("` ("` =W)I=&5F;&XH(D5N=&5R:6YG($9)1D]?3&EN:V5D3&ES=%],;V-K
M9G)E92Y$97%U975E*"DB*3L-"B` ("` ("` ("!S8V]P92`H<W5C8V5S<RD 
M=W)I=&5F;&XH(D9)1D]?3&EN:V5D3&ES=%],;V-K9G)E92Y$97%U975E*"D 

M9"!03F]D92!O;&1&:7)S=#L-
M('-H87)E9"!(4%)E8U1Y<&4 :'`P(#T 2%!296-4>7!E+D%C<75I<F4H*3L-
M"B` ("` ("` <V-O<&4 *&5X:70I('L 2%!296-4>7!E+E)E;&5A<V4H:'`P

M/2!(4%)E8U1Y<&4N06-Q=6ER92 I.PT*("` ("` ("!S8V]P92`H97AI="D 

M("!B;V]L(&AA=F5!9'9A;F-E9$9I<G-T(#T
M:6QE(" A:&%V94%D=F%N8V5D1FER<W0I('L-"B` ("` ("` ("!O;&1&:7)S
M="`](&9I<G-T.PT*("` ("` ("` (&AP,"YH87IA<F1?(#T ;VQD1FER<W0[


M("` ("` <VAA<F5D(%!.;V1E(&]L9$9I<G-T3F5X="`](&]L9$9I<G-T+FYE

M("` ("` ("` :68 *&]L9$9I<G-T(#T](&9I<G-T*2![(`T*("` ("` ("` 
M("` :68 *&]L9$9I<G-T(#T](&]L9$QA<W0I('L-"B` ("` ("` ("` ("` 

M<F5T=7)N(&9A;'-E.R`O+R!(4', 9G)E960-"B` ("` ("` ("` ("` ?0T*
M("` ("` ("` ("` ("!C87,H)FQA<W0L;VQD3&%S="QO;&1&:7)S=$YE>'0I


M("` (&AA=F5!9'9A;F-E9$9I<G-T(#T 8V%S*"9F:7)S="QO;&1&:7)S="QO
M;&1&:7)S=$YE>'0I.PT*("` ("` ("` ("` ?0T*("` ("` ("` ('T-"B` 
M("` ("` ?0T*("` ("` ?2`O+R!I9B!W92!G970 :&5R92P 2%`G<R!H879E
M(&)E96X 9G)E960L($D =&AI;FLN/S\-"B` ("` (&1E8G5G(" W*2!W<FET
M969L;B B06)O=70 =&\ 1G)E94YO9&4H)7,I(BQC87-T*&-O;G-T*'9O:60J



M=F]I9"!I;FET:6%L:7IE*"D >WT-"B` ("!S=&%T:6, <W1R:6YG('-H;W)T

M9R!D97-C<FEP=&EO;B I('L <F5T=7)N(")-97-S86=E(%!A<W-I;F<L(%5N
M:VYO=VX <W1O<F%G92P 1DE&3R([('T-"B` ("`-"B` ("!M:7AI;B!);FIE

M92A086-K86=E('`I("\O('!U<VAF<F]N=`T*("` ('L-"B` ("` (&1E8G5G
M(" W*2![('=R:71E9FQN*")S96YD:6YG(BD[('T-"B` ("` ('-E;F0H<F5C

M;G0B*3L ?0T*("` ('T-"B` ("`-"B` ("!S=&%T:6, 8F]O;"!$97%U975E
M*&]U="!086-K86=E('`I("\O('!O<&)A8VL-"B` ("![(`T*("` ("` 9&5B


M("` ("` (&1E8G5G(" W*2![('=R:71E9FQN*")R96,G9"$B*3L ?0T*("` 

M86-K86=E7W1O<W1R:6YG*%!A8VMA9V4 <"D >PT*("` (&%U=&\ 82`](&%P
M<&5N9&5R(7-T<FEN9R I.PT*("` (&9O<FUA='1E9%=R:71E*&$L(E`Z('1I
M;64])7,[('-E;F1E<E]I9#TE<SL <V5N9&5R7W-E<3TE<R(L<"YP5&EM92YV

5=7)N(&$N9&%T83L-"B` ?0T*?0T*
`
end
Feb 04 2011
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Adam Conner-Sax:

 I wrote the tester as an exercise in learning D.  The language is great;
 perfect for me as someone who loved generics in C++ but found that all the
 cool things you could do got ugly and messy fast.
Few notes on the form of your code: - I suggest to use module names all in lowercase Some alternative ways to write some of your code: auto sum = reduce!("a+b")(0.0,latency_data); ==> auto sum = reduce!q{a + b}(0.0, latencyData); auto sd = reduce!(f)(0.0,latency_data); ==> auto sd = reduce!f(0.0, latencyData); Test_Parameters[] tests; tests ~= Test_Parameters(1,10,0,0); tests ~= Test_Parameters(4,10,0,0); ... ==> auto tests = [TestParameters(1,10,0,0), TestParameters(4,10,0,0), ... immutable int[] widths = [11,10,10,10,10,10,10,10]; ==> enum int[] widths = [11, 10, 10, 10, 10, 10, 10, 10]; debug (5) { printf("Rec'd: (pkt %i) %.*s\n",received,QT.package_tostring(p)); } ==> debug(5) printf("Rec'd: (pkt %i) %.*s\n", received, QT.packageToString(p)); Bye, bearophile
Feb 04 2011
prev sibling parent reply Sean Kelly <sean invisibleduck.org> writes:
Adam Conner-Sax Wrote:
 
 1) I couldn't get the synchronized class version (as opposed to using
 synchronized statements in the functions) to run.  It would hang in odd ways.
  This may be related to a bug I reported earlier (and Sean was helpful enough
 to fix!) so this may be moot.
'synchronized' as a class label may not be implemented in the compiler yet. I'd stick to explicitly labeling methods are 'synchronized' for now.
 2) Message passing is slow in my tests.  Often an order of magnitude or more
 slower than the fastest (lock-free queue).  I expect to pay some price for the
 convenience, etc. but that seems excessive.
The limiting factor at this point is the cost of copying the Message struct around during processing. I've eliminated nearly all copies by passing by ref internally, but I believe an unnecessary copy or two may still remain. I'll see about tuning this further. Tuning the ctor and copy ops in Variant and Tuple would help as well, since nearly all the time spent is in those routines. For what it's worth, it's fairly easy to time this by building with -profile and having the main thread send messages to itself (since -profile doesn't yet work in multithreaded apps).
 4) I still don't totally understand shared.  It does what I expect when
 variables are static.  That's why all the queues are static objects.  But that
 doesn't scale so well (I know I could set up static factories for static
 objects but that seems like it shouldn't be necessary).  When I put an
 unshared variable in a non-static class and then use the class from multiple
 threads, the variable acts shared.  Is that a bug or a feature?
Maybe you're just lucky? It's hard to reason about behavior without an example.
Feb 04 2011
next sibling parent Adam Conner-Sax <adam_conner_sax yahoo.com> writes:
== Quote from Sean Kelly (sean invisibleduck.org)'s article
 Adam Conner-Sax Wrote:
 1) I couldn't get the synchronized class version (as opposed to using
 synchronized statements in the functions) to run.  It would hang in odd ways.
  This may be related to a bug I reported earlier (and Sean was helpful enough
 to fix!) so this may be moot.
'synchronized' as a class label may not be implemented in the compiler yet. I'd
stick to explicitly labeling methods are 'synchronized' for now. I couldn't get that to work either. What does work is a "synchronized" block of code. That seems potentially more efficient also.
 2) Message passing is slow in my tests.  Often an order of magnitude or more
 slower than the fastest (lock-free queue).  I expect to pay some price for the
 convenience, etc. but that seems excessive.
The limiting factor at this point is the cost of copying the Message struct
around during processing. I've eliminated nearly all copies by passing by ref internally, but I believe an unnecessary copy or two may still remain. I'll see about tuning this further. Tuning the ctor and copy ops in Variant and Tuple would help as well, since nearly all the time spent is in those routines. For what it's worth, it's fairly easy to time this by building with -profile and having the main thread send messages to itself (since -profile doesn't yet work in multithreaded apps). Right. I've run into the multithreaded profiling issue. What you're describing makes sense: message passing has a much higher minimum time (7-8 us) than any of the others (1-2 us). That could be copying. I had thought it was some sort of wakeup to the receiver. The other methods just have a while loop waiting on new data rather than the blocking "receive" so I imagined there was some cost to waking up the receive thread.
 4) I still don't totally understand shared.  It does what I expect when
 variables are static.  That's why all the queues are static objects.  But that
 doesn't scale so well (I know I could set up static factories for static
 objects but that seems like it shouldn't be necessary).  When I put an
 unshared variable in a non-static class and then use the class from multiple
 threads, the variable acts shared.  Is that a bug or a feature?
Maybe you're just lucky? It's hard to reason about behavior without an example.
Maybe. I'd rather it not work this way (sharing even though not marked shared). Then I could put the queues into non-static structures and get the shared and TLS the way I expect. That would make using them from a spawned function a bit trickier but I think that could be handled. Thanks for the thoughts. Adam
Feb 04 2011
prev sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Friday 04 February 2011 16:09:08 Sean Kelly wrote:
 Adam Conner-Sax Wrote:
 1) I couldn't get the synchronized class version (as opposed to using
 synchronized statements in the functions) to run.  It would hang in odd
 ways.
 
  This may be related to a bug I reported earlier (and Sean was helpful
  enough
 
 to fix!) so this may be moot.
'synchronized' as a class label may not be implemented in the compiler yet. I'd stick to explicitly labeling methods are 'synchronized' for now.
IIRC, according to TDPL, it's supposed to be the whole class or non if it, not a per-function thing. So, if that's not how it works at the moment, that it's another of the things that hasn't been fixed to match TDPL yet. - Jonathan M Davis
Feb 04 2011