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:6UP;W)T('-T9"YD871E=&EM93L-"FEM<&]R="!S=&0N<W1D:6\[#0II;7!O
M<G0 <W1D+F-S=')E86T[#0II;7!O<G0 <W1D+F-O;F-U<G)E;F-Y.PT*:6UP
M;W)T('-T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: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 ,"D /R!U;FEF;W)M*#`L,BIU<VHI(#H ,"D[#0H)9&5B=6< 
M*# I('L =W)I=&5F;&XH(FYE>'1?<VQE97!?=7,])7,B+&YE>'1?<VQE97!?
M=7,I.R!]#0H)5&AR96%D+G-L965P*#$P*FYE>'1?<VQE97!?=7,I.PT*("` 
M("` ?0T*("` ('T-"B` ("!D96)U9R`H,BD >R!W<FET969L;B B1FEN:7-H
M960 <V5N9&5R("5S(BQS96YD97)?:60I.R!]#0H ("` 4V5N9&5R7T1O;F4 
M<V0[#0H ("` <V0N<V5N9&5R7VED(#T <V5N9&5R7VED.PT*("` ('-E;F0H
M;W=N97)4:60L('-D*3L-"B` ?0T*("`-"B` =F]I9"!R96-E:79E7V1A=&$H
M:6X :6YT(&YU;5]T;U]B95]R96-E:79E9"P 5&ED(&]W;F5R5&ED*2![#0H 
M("` 9&5B=6< *#(I('L <')I;G1F*")%;G1E<FEN9R!R96-E:79E7&XB*3L 
M?0T*("` ($%R<F%Y(61O=6)L92!L871E;F-Y.PT*("` (&QA=&5N8WDN;&5N
M9W1H*&YU;5]T;U]B95]R96-E:79E9"D[#0H ("` :6YT(')E8V5I=F5D(#T 
M,#L-"B` ("!15"Y086-K86=E('`[#0H ("` +R]R96-E:79E*"A4:')E861S
M7U)E861Y('1D*2![?2D[#0H ("` =VAI;&4 *')E8V5I=F5D(#P ;G5M7W1O
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
M5&EM92`]('-Y<W1I;64H*3L #0H)<')O8V5S<U]P86-K86=E*'`L<F5C96EV
M960L<E1I;64L;&%T96YC>2D[#0H)*RMR96-E:79E9#L-"B` ("` ('T-"B` 
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
M960I.R!]#0H ("` ("!]#0H ("` ?0T*("` ("\O(&-O<'D 9&%T82!I;G1O
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=& I#0H ("` ("!S:&%R961?;&%T96YC>5MK72`](&QA=&5N8WE;:UT[(`T*
M#0H ("` 9&5B=6< *#(I('L =W)I=&5F;&XH(D9I;FES:&5D(')E8V5I=F5R
M(BD[('T-"B` ("!296-E:79E<E]$;VYE(')D.PT*("` ('-E;F0H;W=N97)4
M:60L<F0I.PT*("!]#0H (`T*("!V;VED('!R;V-E<W-?<&%C:V%G92AI;B!1
M5"Y086-K86=E('`L(&EN('5I;G0 <F5C96EV95]N=6UB97(L(&EN(%1I8VMS
M(')4:6UE+"!!<G)A>2%D;W5B;&4 ;&%T96YC>2D #0H ('L-"B` ("!D;W5B
M;&4 96QA<'-E9%]U<R`]("AR5&EM92`M('`N<%1I;64I+G1O36EC<F]S96-O
M;F1S(2AD;W5B;&4I*"D[#0H ("` 9&5B=6< *#4I('=R:71E9FQN*")%;&%P
M<V5D.B`E9B!U<R(L96QA<'-E9%]U<RD[#0H ("` ;&%T96YC>5MR96-E:79E
M7VYU;6)E<ET /2!E;&%P<V5D7W5S.PT*("!]#0I]#0H-"G-T<G5C="!497-T
M7U!A<F%M971E<G, #0I[#0H ('1H:7,H=6EN="!H;7,L('5I;G0 <'!S+"!U
M:6YT(&%P<',L('5I;G0 ;78I(`T*("![#0H ("` :&]W7VUA;GE?<V5N9&5R
M<R`](&AM<SL-"B` ("!P86-K971S7W!E<E]S96YD97( /2!P<',[#0H ("` 
M879E<F%G95]P86-K971S7W!E<E]S(#T 87!P<SL-"B` ("!M:6-R;W-E8V]N
M9%]V87)I86)I;&ET>2`](&UV.PT*("!](`T*#0H ('5I;G0 :&]W7VUA;GE?
M<V5N9&5R<SL-"B` =6EN="!P86-K971S7W!E<E]S96YD97([#0H ('5I;G0 
M879E<F%G95]P86-K971S7W!E<E]S.PT*("!U:6YT(&UI8W)O<V5C;VYD7W9A
M<FEA8FEL:71Y.PT*?0T*#0H-" T*=&5M<&QA=&4 475E=65?5&5S=%]&=6YC
M=&EO;G,H42D #0I[#0H (&%L:6%S(%%U975E<R$H42Y$871A7U1Y<&4I(%%4
M.PT*("!A;&EA<R!1(%%U975E7U1Y<&4[#0H-" T*("!D;W5B;&5;72!R=6Y?
M=&5S="AI;B!497-T7U!A<F%M971E<G, ='`I(`T*("![#0H ("` 875T;R!M
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
M9&5R.PT*("` (&1O=6)L95M=(&QA=&5N8WD[#0H ("` ;&%T96YC>2YL96YG
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=7-?9&5L87D /2!C87-T*'5I;G0I*#$P,#`P,#`J*"AC87-T*&1O=6)L92ET
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
M96X[#0H ("` #0H ("` 86QI87, 5&AR96%D7T9U;F-T:6]N<R$H42D 5$8[
M(`T*(`T*("` (&%U=&\ <E1I9"`]('-P87=N*"941BYR96-E:79E7V1A=&$L
M=&]T86Q?<&%C:V5T<RQM86EN5&ED*3L-" T*("` (&9O<F5A8V  *&L[(#`N
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-?
M9&5L87DL=7-?:FET=&5R+&UA:6Y4:60L<E1I9"D[#0H ("` ?0T*#0H-"B` 
M("`O+R!A;&P =&AR96%D<R!S=&%R=&5D(`T*("` ("\O(&YO=R!W86ET('5N
M=&EL('1H97D 87)E(&9I;FES:&5D#0H ("` #0H ("` #0H ("` 9F]R96%C
M:"`H:SL ,"XN='`N:&]W7VUA;GE?<V5N9&5R<RD #0H ("` ("!R96-E:79E
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+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;B!R97-U;'0[#0I]#0H-" T*<W1R=6-T('-M86QL7VUE<W-A9V4 #0I[#0H 
M(&1O=6)L95LQ,%T ;G5M8F5R<SL-"B` 8VAA<ELQ,%T 9FEE;&0Q.PT*("!C
M:&%R6S$P72!F:65L9#([#0I]#0H-"G9O:60 ;6%I;B I(`T*>PT*("!S8V]P
M92`H<W5C8V5S<RD >R!W<FET969L;B B4G5N($-O;7!L971E+B(I.R!]#0H 
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
M=&%B;&4 :6YT(&)I;G-?9F]R7V]U='!U="`](#$P,#L-"B` 8F]O;"!W<FET
M95]D871A7V9I;&5S(#T 9F%L<V4[#0H-"B` +R\ 475E=65S('1O('1E<W0-
M"B` :6UM=71A8FQE('-T<FEN9UM=('%U975E7W1Y<&5S(#T 6PT*"0D)"2` 
M("`O+R)#4WEN8U],3%]&249/7U1!(BP-" D)"0D ("` +R\B0U-Y;F-?3$Q?
M1DE&3U]&3"(L#0H)"0D)("` ("))4WEN8U],3%]&249/7U1!(BP-"B` ("` 
M("` ("` ("` ("` ("` ("` ("` ("` ("` ("` ("))4WEN8U],3%]&249/
M7T9,(BP-"B` ("` ("` ("` ("` ("` ("` ("` ("` ("` ("` ("` (")&
M249/7TQI;FME9$QI<W1?3&]C:T9R965?475E=64B+`T*("` ("` ("` ("` 
M("` ("` ("` ("` ("` ("` ("` ("` (DU07T9)1D\B#0H ("` ("` ("` 
M("` ("` ("` ("` ("` ("` ("` ("` ("!=.PT*#0H (&-O;G-T(&EN="!.
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($AO=R!T;R!F:7 _#0H-"B` 0FEN7T1A=&%;72!B:6YN961?;&%T96YC:65S
M.R` #0H (&)I;FYE9%]L871E;F-I97,N;&5N9W1H(#T 8FEN<U]F;W)?;W5T
M<'5T.PT*#0H ("\O('1E<W1S('1O(')U; T*("!497-T7U!A<F%M971E<G-;
M72!T97-T<SL-"B` #0H ('1E<W1S('X](%1E<W1?4&%R86UE=&5R<R Q+#$P
M+#`L,"D[#0H ('1E<W1S('X](%1E<W1?4&%R86UE=&5R<R T+#$P+#`L,"D[
M#0H ('1E<W1S('X](%1E<W1?4&%R86UE=&5R<R T+#$P,"PQ,#`L,"D[#0H 
M(`T*("!T97-T<R!^/2!497-T7U!A<F%M971E<G,H-"PQ,#`P+#$P,#`L,"D[
M#0H (`T*("!T97-T<R!^/2!497-T7U!A<F%M971E<G,H-"PU,#`P+#4P,#`L
M,"D[#0H ('1E<W1S('X](%1E<W1?4&%R86UE=&5R<R T+#4P,#`P+#4P,#`P
M+#`I.PT*("!T97-T<R!^/2!497-T7U!A<F%M971E<G,H-"PU,#`P,"PQ,#`P
M,#`L,"D[#0H (`T*("`O+W1E<W1S('X](%1E<W1?4&%R86UE=&5R<R T+#4P
M,#`P,"PQ,#`P,#`L,"D[#0H ("\O=&5S=', ?CT 5&5S=%]087)A;65T97)S
M*#8L-3`P,#`P+#$P,#`P,"PP*3L-"B` +R]T97-T<R!^/2!497-T7U!A<F%M
M971E<G,H."PU,#`P,#`L,3`P,#`P+#`I.PT*("`-" T*("!S971B=68H9&]U
M="YF:6QE+&YU;&PI.R`O+R!U;F)U9F9E<B!S=&1O=70 <V\ =V4 <V5E(&]U
M='!U="!A<R!I="!O8V-U<G,-"B` #0H ('=R:71E9FQN*")<;D%L;"!T:6UE
M<R!I;B!M:6-R;W-E8V]N9', =6YL97-S(&]T:&5R=VES92!S<&5C:69I960N
M(BD[#0H ('=R:71E9FQN*"(\;6EN/B!A;F0 /&UA>#X 87)E(&%V97)A9V5S
M(&]V97( 9F%S=&5S="!A;F0 <VQO=V5S="`Q)24 <F5S<&5C=&EV96QY+B(I
M.PT*("!W<FET969L;B B(BD[#0H (`T*#0H-"B` 8F]O;"!F:7)S=%]T:6UE
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
M92D 450[#0H #0H ("` ;6EX:6XH;6%K95%U975E5'EP951U<&QE*'%U975E
M7W1Y<&5S*2D[("\O(&EN:F5C="!1=65U95]4>7!E<PT*#0H ("` +R\ =W)I
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
M92YD97-C<FEP=&EO;BD[#0H ("` ("!W<FET969L;B B(BD[#0H ("` ("`-
M"B` ("` (&9I<G-T7W1I;65?=&AR;W5G:"`](&9A;'-E.PT*("` ('T-" T*
M("` (&%U=&\ <&MG7V1E<V, /2!A<'!E;F1E<B%S=')I;F<[#0H ("` #0H 
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.PT*("` ('=R:71E9FQN*"(E<R(L<&MG7V1E<V,N9&%T82D[#0H ("` #0H 
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*"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T*"2` #0H)("!F;W)E86-H("AK.R`P
M+BYB:6YS7V9O<E]O=71P=70I#0H)("` (&1A=%]F+G=R:71E9FQN*"(E<UQT
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
M;FYE9%]L871E;F-I97-;:UTN0T1&*3L-" D (&1A=%]F+F-L;W-E*"D[#0H)
M?0T*#0H)=W)I=&5F;&XH(B5S(BQR=6Y?:6YF;R%Q=65U95]T>7!E*&QA+')U
M;E]S*2D[#0H)<75E=65?;G5M8F5R*RL[#0H ("` ("!]#0H ("` ("!T97-T
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[
M#0II;7!O<G0 <W1D+F%R<F%Y.PT*:6UP;W)T('-T9"YF;W)M870[#0II;7!O
M<G0 <W1D+G-T9&EO.PT*:6UP;W)T('-T9"YA;&=O<FET:&T[#0II;7!O<G0 
M<W1D+FUA=& [#0H-"G1E;7!L871E(%%U975E<R`H5"D #0I[(`T*("!S=')U
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 
M9'5M;7D[#0H ('T-"B` #0H (&-L87-S($YO9&4H52D #0H ('L-"B` ("!5
M('!K9SL-"B` ("!.;V1E(2A5*2!N97AT.PT*("!]#0H-"B` 86QI87, 3F]D
M92$H4&%C:V%G92D 4$YO9&4[#0H-"B` #0H (`T*("!M:7AI;B!T96UP;&%T
M92!);FIE8W110F]I;&5R<&QA=&4H*0T*("![#0H ('!R:79A=&4Z#0H ("` 
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#0H ('!U8FQI8SH-"B` ("!S=&%T:6, =F]I9"!S971?<F5C96EV97)?5&ED
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:"!I;B!A;F0 9FEG=7)E(&]U="!P86-K86=E('1Y<&5S#0H ('T-"B` #0H-
M"B` #0H ('!R:79A=&4 8VQA<W, 5')I=FEA;%]!;&QO8V%T;W(-"B` >PT*
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 
M(BA$92E!;&QO8V%T92!V:6$ *$=#*6YE=R([('T-"B` ("!S=&%T:6, =F]I
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!'
M971.;V1E*"D #0H ("` >PT*("` ("` <F5T=7)N(&YE=R!S:&%R960H4$YO
M9&4I.PT*("` ('T-"B` ?0T*#0H (`T*("`O+R!N;R!N965D('1O('-Y;F-H
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
M4$YO9&4I.R!]#0H ("` <W1A=&EC('9O:60 :6YI=&EA;&EZ92 I('L :&5A
M9"`](&YE=R!S:&%R960H4$YO9&4I.R!]#0H ("` #0H ("` #0H ("` <W1A
M=&EC('9O:60 1G)E94YO9&4H<VAA<F5D(%!.;V1E(&XI('-H87)E9"![#0H 
M("` ("!D96)U9R U*2![('=R:71E9FQN*")&<F5E3F]D92!#86QL960H*5QN
M(BD[('T-"B` ("` (&XN;F5X="`](&AE860N;F5X=#L-"B` ("` (&AE860N
M;F5X="`](&X[#0H ("` ?0T*("` (`T*("` ('-T871I8R!S:&%R960H4$YO
M9&4I($=E=$YO9&4H*2!S:&%R960 >PT*("` ("` 9&5B=6<H-2D >R!W<FET
M969L;B B1V5T3F]D92!#86QL960H*2(I.R!]#0H ("` ("!S8V]P92`H<W5C
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;B`B1DPB.R!]#0H ("` <W1A=&EC('-T<FEN9R!D97-C<FEP=&EO;B I('L 
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:6, =F]I9"!I;FET:6%L:7IE*"D #0H ("` >R`-"B` ("` ('-Y;F-H<F]N
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("` (&1E8G5G*#4I('L =W)I=&5F;&XH(D9R965.;V1E($-A;&QE9" I7&XB
M*3L ?0T*("` ("` <WEN8VAR;VYI>F5D("AL;V-K7V]B:BD >PT*("` ("` 
M("!N+FYE>'0 /2!H96%D+FYE>'0[#0H ("` ("` (&AE860N;F5X="`](&X[
M#0H ("` ("!]#0H ("` ?0T*("` (`T*("` ('-T871I8R!S:&%R960H4$YO
M9&4I($=E=$YO9&4H*2!S:&%R960 >PT*("` ("` 9&5B=6<H-2D >R!W<FET
M969L;B B1V5T3F]D92!#86QL960H*2(I.R!]#0H ("` ("!S8V]P92`H<W5C
M8V5S<RD >R!D96)U9R U*2![('=R:71E9FQN*")'971.;V1E(%-U8V-E9&1E
M9" I(BD[('T ?0T*("` ("` #0H ("` ("!S:&%R960 4$YO9&4 ;CL-"B` 
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
M971U<FX ;F5W('-H87)E9"A03F]D92D[#0H ("` ("` (&AE860N;F5X="`]
M(&XN;F5X=#L-"B` ("` ('T-"B` ("` (&XN;F5X="`](&YU;&P[#0H ("` 
M("!R971U<FX ;CL-"B` ("!]#0H ('T-"B` #0H (`T*("!S>6YC:')O;FEZ
M960 8VQA<W, 0U-Y;F-?3$Q?1DE&3RA!;&QO8RD-"B` >R` ("`-"B` ("!M
M:7AI;B!);FIE8W110F]I;&5R<&QA=&4[#0H ("` #0H ('!R:79A=&4Z#0H 
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+R\ <'5S:&9R;VYT#0H ("` >PT*("` ("` 9&5B=6< *#<I('L =W)I=&5F
M;&XH(D5N=&5R:6YG($-3>6YC7TQ,7T9)1D]?1DPN16YQ=65U92 I(BD[('T-
M"B` ("` (&%U=&\ <&X /2!!;&QO8RY'971.;V1E*"D[#0H ("` ("!P;BYP
M:V< /2!P.PT*("` ("` :&5A9"YN97AT(#T <&X[#0H ("` ("!H96%D(#T 
M<&X[#0H ("` ?0T*("` (`T*("` ('-T871I8R!B;V]L($1E<75E=64H;W5T
M(%!A8VMA9V4 <"D +R\ <&]P8F%C:PT*("` ('L-"B` ("` (&EF("AH96%D
M(&ES('1A:6PI(`T*("` ("` ("!R971U<FX 9F%L<V4[#0H ("` ("!A=71O
M('1M<"`]('1A:6P[#0H ("` ("!T86EL(#T =&%I;"YN97AT.PT*("` ("` 
M<"`]('1M<"YN97AT+G!K9SL-"B` ("` ($%L;&]C+D9R965.;V1E*'1M<"D[
M#0H ("` ("!R971U<FX =')U93L-"B` ("!]#0H ('T-" T*("!A;&EA<R!#
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
M=&]R*2!#4WEN8U],3%]&249/7T9,.PT*("`-"B` 8VQA<W, 25-Y;F-?3$Q?
M1DE&3RA!;&QO8RD #0H ('L-"B` ("!M:7AI;B!);FIE8W110F]I;&5R<&QA
M=&4[#0H ("` #0H ('!R:79A=&4Z#0H ("` <W1A=&EC('-H87)E9"!03F]D
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("![#0H ("` ("!L;V-K7V]B:B`](&YE=R!S:&%R960H3V)J96-T*3L-"B` 
M("!]#0H ('!U8FQI8SH-"B` ("!S=&%T:6, =F]I9"!I;FET:6%L:7IE*"D 
M>R`-"B` ("` ($%L;&]C+FEN:71I86QI>F4H*3L-"B` ("` (&AE860 /2!T
M86EL(#T 06QL;V,N1V5T3F]D92 I.R`-"B` ("!]#0H ("` #0H ("` <W1A
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
M8VMA9V4 <"D +R\ <'5S:&9R;VYT#0H ("` >PT*("` ("` 9&5B=6< *#<I
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"B` ("` ('!N+G!K9R`]('`[#0H ("` ("!S>6YC:')O;FEZ960 *&QO8VM?
M;V)J*2![#0H ("` ("` (&AE860N;F5X="`]('!N.PT*("` ("` ("!H96%D
M(#T <&X[#0H ("` ("!]#0H ("` ?0T*("` (`T*("` ('-T871I8R!B;V]L
M($1E<75E=64H;W5T(%!A8VMA9V4 <"D +R\ <&]P8F%C:PT*("` ('L-"B` 
M("` (&1E8G5G(" W*2![('=R:71E9FQN*")%;G1E<FEN9R!)4WEN8U],3%]&
M249/7T9,+D1E<75E=64H*2(I.R!]#0H ("` ("`-"B` ("` ('-H87)E9"!0
M3F]D92!T;7`[#0H ("` ("!S>6YC:')O;FEZ960 *&QO8VM?;V)J*2![#0H 
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"B` ("` ($%L;&]C+D9R965.;V1E*'1M<"D[#0H ("` ("!R971U<FX =')U
M93L-"B` ("!]#0H ('T-" T*("!A;&EA<R!)4WEN8U],3%]&249/(2A4<FEV
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
M7TQ,7T9)1D]?1DP[#0H (`T*("`-"B` <')I=F%T92!C;&%S<R!,;V-K1G)E
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=&%T:6, =&AI<R I('L :&5A9"`](&YE=R!S:&%R960H4$YO9&4I.R!]#0H 
M("` #0H ("` <W1A=&EC('9O:60 1G)E94YO9&4H<VAA<F5D(%!.;V1E(&XI
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#0H ("` ("!D;R![#0H ("` ("` (&XN;F5X="`](&AE860N;F5X=#L-"B` 
M("` ('T =VAI;&4 *"%C87,H)FAE860N;F5X="QN+FYE>'0L;BDI.R`-"B` 
M("!]#0H ("` #0H ("` <W1A=&EC('-H87)E9"A03F]D92D 1V5T3F]D92 I
M('L-"B` ("` (`T*("` ("` 9&5B=6<H-2D >R!P<FEN=&8H(D=E=$YO9&4 
M0V%L;&5D*"E<;B(I.R!]#0H ("` ("!S8V]P92`H<W5C8V5S<RD >R!D96)U
M9R U*2![('!R:6YT9B B1V5T3F]D92!3=6-C961D960H*5QN(BD[('T ?0T*
M("` ("` <VAA<F5D(%!.;V1E(&X[#0H ("` ("!D;R![#0H ("` ("` (&X 
M/2!H96%D+FYE>'0[#0H ("` ("` (&EF("AN(&ES(&YU;&PI#0H ("` ("` 
M("` <F5T=7)N(&YE=R!S:&%R960H4$YO9&4I.PT*("` ("` ?2!W:&EL92`H
M(6-A<R F:&5A9"YN97AT+&XL;BYN97AT*2D[#0H ("` ("!N+FYE>'0 /2!N
M=6QL.PT*("` ("` <F5T=7)N(&X[#0H ("` ?0T*("!]#0H-" T*("!C;&%S
M<R!(4%)E8U1Y<&4 >R`-"B` <'5B;&EC. T*("` (&EM;75T86)L92!I;G0 
M2R`](#([("\O(&%V86EL86)L92!(4',O=&AR96%D#0H ("` #0H ("` +R\ 
M<VAA<F5D('-T871I8R`H9VQO8F%L*2!M96UB97)S("` #0H ('!R:79A=&4Z
M#0H ("` <VAA<F5D('-T871I8R!(4%)E8U1Y<&4 :&5A9%\[("\O(&=L;V)A
M;`T*("` ('-H87)E9"!S=&%T:6, :6YT(&QI<W1,96Y?(#T ,#L +R\ 9VQO
M8F%L#0H ("` <VAA<F5D('-T871I8R!I;G0 4E\ /2`Q,#L +R\ 9VQO8F%L
M#0H ("` #0H-"B` ("`O+R!P97( 2&%Z87)D(%!O:6YT97(-"B` ("!S:&%R
M960 2%!296-4>7!E(&YE>'1?.PT*("` ('-H87)E9"!I;G0 86-T:79E7SL 
M("` #0H ("` #0H ('!U8FQI8SH-"B` ("!S:&%R960 4$YO9&4 :&%Z87)D
M7SL-"B` ("`-" T*("` ('-T871I8R!S:&%R960H2%!296-4>7!E*2!H96%D
M*"D >R!R971U<FX :&5A9%\[('T #0H ("` <W1A=&EC(&EN="!L:7-T3&5N
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!!
M8W%U:7)E*"D >PT*("` ("` 9&5B=6< *#<I('L-"B` ("` ("` =W)I=&5F
M;&XH(BT^2%!296-4>7!E+D%C<75I<F4H*2(I.PT*("` ("` ?0T*("` ("` 
M#0H ("` ("`O+W1R>2!T;R!R96-Y8VQE(&%N(&]L9"!O;F4-"B` ("` ('-H
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
M=F5?('Q\("%C87,H)G`N86-T:79E7RPP+#$I*2!C;VYT:6YU93L-" ED96)U
M9R`H-RD >R!W<FET969L;B B06-Q=6ER960 ;VQD(&AP($` )7,N(BQC87-T
M*&-O;G-T*'9O:60J*2EP*3L ?2` #0H ("` ("` (')E='5R;B!P.R`O+R!N
M;W0 86-T:79E(&%N9"!T:&5N(&-A<R!S=6-C965D960 ;6%R:VEN9R!I="!A
M8W1I=F4-"B` ("` ('T-"B` ("` (&1E8G5G*#<I('=R:71E9FQN*")(4%)E
M8U1Y<&4N06-Q=6ER92 I.B!C86YN;W0 <F5C>6-L92!A;B!(4"X ($UA:VEN
M9R!N97<N(BD[#0H-"B` ("` ("\O('=E(&YE960 82!N97< ;VYE+"!I;F-R
M96UE;G0 ;&ES="!L96YG=& -"B` ("` (&EN="!O;&1,96X[#0H ("` ("!D
M;R![#0H ("` ("` (&]L9$QE;B`](&QI<W1,96Y?.PT*("` ("` ?2!W:&EL
M92`H(6-A<R F;&ES=$QE;E\L;VQD3&5N+&]L9$QE;BLQ*2D[#0H ("` ("`O
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,
M96Y?+B(I.PT*("` ("` <"`](&YE=R!S:&%R960H2%!296-4>7!E*3L #0H 
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("` ('T =VAI;&4 *"%C87,H)FAE861?+&]L9"QP*2D[("` ("` #0H ("` 
M("!D96)U9R`H-RD >R!W<FET969L;B B06-Q=6ER960 ;F5W(&AP($` )7,N
M(BQC87-T*&-O;G-T*'9O:60J*2EP*3L ?2` #0H ("` ("!R971U<FX <#L-
M"B` ("!]#0H-"B` ("!S=&%T:6, =F]I9"!296QE87-E*'-H87)E9"!(4%)E
M8U1Y<&4 <"D >PT*("` ("` <"YH87IA<F1?(#T 8V%S="AS:&%R960 4$YO
M9&4I;G5L;#L-"B` ("` ('`N86-T:79E7R`](#`[("\O('-O(&ET(&-A;B!B
M92!R92UU<V5D#0H ("` ("!D96)U9R`H-RD >R!W<FET969L;B B4F5L96%S
M960 :'` 0"`E<RXB+&-A<W0H8V]N<W0H=F]I9"HI*7`I.R!]("`-"B` ("!]
M#0H ('T-" T*("!A;&EA<R!!<'!E;F1E<B$H<VAA<F5D*%!.;V1E*5M=+'-H
M87)E9"A03F]D92DI($YO9&5,:7-T.PT*("`O+V%L:6%S('-H87)E9"A.;V1E
M*2I;72!.;V1E3&ES=#L-"B` #0H (`T*("!C;&%S<R!(4$Q&7T9R965,:7-T
M('L-"B` <'5B;&EC. T*("` ("\J#0H ("` ("!S:&%R960 <W1A=&EC($A0
M4F5C5'EP95M+75M=($A03&ES=#L +R\ 9VQO8F%L#0H ("` ("!S=&%T:6, 
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.R`-"B` ("` ("\O(&YO=R!W92!C86X ;&]O<"!O=F5R('1H97-E#0H ("` 
M*B\-" T*("!P<FEV871E. T*("` (`T*("` ('-T871I8R!.;V1E3&ES="!R
M;&ES=#L +R\ =&AR96%D(&QO8V%L#0H ("` <VAA<F5D('-T871I8R!03F]D
M92!H96%D.R`O+R!I<R!S:&%R960 (`T*("` (`T*#0H ("` +R\ ;VYC92!P
M97( =&AR96%D#0H ("` <W1A=&EC('1H:7,H*2![(`T*("` ("` <FQI<W0N
M<F5S97)V92A(4%)E8U1Y<&4N4B I*3L-"B` ("!]#0H-"B` <'5B;&EC. T*
M("` ('-H87)E9"!S=&%T:6, =&AI<R I('L :&5A9"`](&YE=R!S:&%R960H
M4$YO9&4I.R!]#0H ("` #0H ("` <W1A=&EC('-H87)E9"A03F]D92D 1V5T
M3F]D92 I(`T*("` ('L #0H ("` ("!S:&%R960 4$YO9&4 ;CL-"B` ("` 
M(&1O('L-"B` ("` ("` ;B`](&AE860N;F5X=#L-"B` ("` ("` :68 *&X 
M:7, ;G5L;"D #0H ("` ("` ("` <F5T=7)N(&YE=R!S:&%R960H4$YO9&4I
M.PT*("` ("` ?2!W:&EL92`H(6-A<R F:&5A9"YN97AT+&XL;BYN97AT*2D[
M#0H ("` ("!D96)U9R`H-RD =W)I=&5F;&XH(E)E='5R;FEN9R!R96-L86EM
M960 ;F]D92!`("5S(BQC87-T*&-O;G-T*'9O:60J*2EN*3L-"B` ("` (&XN
M;F5X="`](&YU;&P[#0H ("` ("!R971U<FX ;CL-"B` ("!]#0H ("` #0H 
M("` #0H ("` <W1A=&EC('9O:60 1G)E94YO9&4H<VAA<F5D(%!.;V1E(&XI
M(`T*("` ('L-"B` ("` (&1E8G5G(" W*2!W<FET969L;B B1G)E94YO9&4 
M0"`E<R(L8V%S="AC;VYS="AV;VED*BDI;BD[#0H ("` ("!R;&ES="YP=70H
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=&4Z#0H ("` +R\ ;F]W('=E(&%D9"!I="!B86-K('1O(&QI<W0-"B` ("!S
M=&%T:6, =F]I9"!296-L86EM3F]D92AS:&%R960 4$YO9&4 ;BD #0H ("` 
M>PT*("` ("` 9&5B=6< *#<I('=R:71E9FQN*")296-L86EM:6YG(&YO9&4 
M0"`E<R(L8V%S="AC;VYS="AV;VED*BDI;BD[#0H ("` ("!D;R![#0H ("` 
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:6, =F]I9"!38V%N*"D #0H ("` >PT*("` ("` 9&5B=6<H."D =W)I=&5F
M;&XH(DA0(%-C86XN(BD[#0H ("` ("!D96)U9R`H,BD 875T;R!S5&EM92`]
M('-Y<W1I;64H*3L-"B` ("` (`T*("` ("` #0H ("` ("`O+R!S=&%G92`Q
M#0H ("` ("!.;V1E3&ES="!H<#L +R\ =&AR96%D(&QO8V%L#0H ("` ("!H
M<"YR97-E<G9E*$A04F5C5'EP92YL:7-T3&5N*"DI.PT*("` ("` <VAA<F5D
M($A04F5C5'EP92!H(#T 2%!296-4>7!E+FAE860[#0H ("` ("!W:&EL92`H
M:"`A:7, ;G5L;"D >PT*("` ("` ("!S:&%R960 4$YO9&4 ;B`](& N:&%Z
M87)D7SL-"B` ("` ("` :68 *&X (6ES(&YU;&PI('L #0H ("` ("` ("` 
M:'`N<'5T*&XI.PT*("` ("` ("!]#0H ("` ("` (&  /2!H+FYE>'1?.PT*
M("` ("` ?0T*("` ("` ("`-"B` ("` (&1E8G5G(" X*2![#0H ("` ("` 
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
M9"!P;VEN=&5R<SH (BD[#0H ("` ("` (&9O<F5A8V  *&YP.R!H<"YD871A
M*0T*("` ("` ("` (&9O<FUA='1E9%=R:71E*&$L(B5S("(L8V%S="AC;VYS
M="AV;VED("HI*6YP*3L-"B` ("` ("` 82YP=70H(EQN(BD[#0H ("` ("` 
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<"D[#0H ("` ("` ('=R:71E9FQN*"(E<R(L82YD871A*3L-"B` ("` ("` 
M?2`-"B` ("` ('T-" T*("` ("` 875T;R!O;&1?<FQI<W1?;&5N9W1H(#T 
M<FQI<W0N9&%T82YL96YG=& [#0H ("` ("`-"B` ("` ($YO9&5,:7-T('1M
M<#L-"B` ("` ('1M<"YR97-E<G9E*&]L9%]R;&ES=%]L96YG=& I.PT*#0H 
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"B` ("` ('T-" T*("` ("` #0H ("` ("`O+R!!;&P =&AE(&-A<W1I;F< 
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;V1E6UTI:'`N9&%T82YD=7`[#0H ("` ("!03F]D95M=('-O<G1E9%]R;"`]
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<FPI.PT*#0H ("` ("`-"B` ("` (&1E8G5G(" X*2![#0H ("` ("` ('L 
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=&5R<SH (BD[#0H ("` ("` ("` 9F]R96%C:"`H;G`[('-O<G1E9%]H<"D-
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#0H ("` ("!F;W)E86-H("AN<#L <V5T26YT97)S96-T:6]N(2A03F]D94QE
M<W-">4]B:F5C=$%D9')E<W,I*'-O<G1E9%]R;"QS;W)T961?:'`I*0T*("` 
M("` ("!T;7`N<'5T*&-A<W0H<VAA<F5D*%!.;V1E*2EN<"D[#0H ("` ("`-
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("!296-L86EM3F]D92AC87-T*'-H87)E9"A03F]D92DI;G`I.PT*#0H ("` 
M("!R;&ES=#UT;7`[#0H ("` ("`-" T*("` ("` 2%!296-4>7!E+G-E=%(H
M8V%S="AI;G0I;')I;G0H,RI(4%)E8U1Y<&4N;&ES=$QE;B I*2D[#0H-"B` 
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
M92DN=&]-:6-R;W-E8V]N9',A*&1O=6)L92D[#0H ("` ("` (&EN="!R96-L
M86EM960 /2!O;&1?<FQI<W1?;&5N9W1H("T <FQI<W0N9&%T82YL96YG=& [
M#0H ("` ("` (&EF("AR96-L86EM960 /"!O;&1?<FQI<W1?;&5N9W1H*0T*
M("` ("` ("` ('!R:6YT9B B2%` 4V-A;B!#;VUP;&5T92`H)68 =7,I+B!2
M96-L86EM960 )6D ;V8 )6E<;B(L96QA<'-E9"P <F5C;&%I;65D+"!O;&1?
M<FQI<W1?;&5N9W1H*3L-"B` ("` ('T-"B` ("!]#0H ('T-"B` #0H (&-L
M87-S($9)1D]?3&EN:V5D3&ES=%],;V-K1G)E95]1=65U90T*("![#0H ("` 
M;6EX:6X 26YJ96-T44)O:6QE<G!L871E.PT*("!P<FEV871E. T*("` ('-T
M871I8R!S:&%R960 4$YO9&4 9FER<W0L;&%S=#L-"B` ("` ("` #0H ('!U
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("!]#0H-"B` ("!S:&%R960 <W1A=&EC('1H:7,H*2![(&EN:71I86QI>F4H
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
M8VMA9V4 <"D-"B` ("![#0H ("` ("!D96)U9R`H-RD >PT*("` ("` ("!W
M<FET969L;B B16YT97)I;F< 1DE&3U],:6YK961,:7-T7TQO8VM&<F5E7U%U
M975E+D5N<75E=64H*2XB*3L #0H ("` ("` ('-C;W!E("AS=6-C97-S*2![
M('=R:71E9FQN*")3=6-C965D960 1DE&3U],:6YK961,:7-T7TQO8VM&<F5E
M7U%U975E+D5N<75E=64H*2XB*3L ?0T*("` ("` ?0T*("` ("` #0H ("` 
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?0T*("` ("` #0H ("` ("!S:&%R960 4$YO9&4 ;VQD3&%S="QO;&1.97AT
M.PT*#0H ("` ("!A=71O(&X /2!(4$Q&7T9R965,:7-T+D=E=$YO9&4H*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="`](&QA<W0[#0H ("` ("` (&AP+FAA>F%R9%\ /2!O;&1,87-T.R`O+R!P
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=&%C:&5D(BD[#0H ("` ("` (&]L9$YE>'0 /2!O;&1,87-T+FYE>'0[#0H 
M("` ("` (&EF("AL87-T(&ES(&]L9$QA<W0I('L ("\O('-T:6QL(&-O;G-I
M<W1E;G0_#0H ("` ("` ("` :68 *&]L9$YE>'0 :7, ;G5L;"D >R`O+R!Y
M97,L('-O(&9A<BX 07)E('=E(&%T('1H92!A8W1U86P =&%I;#\-"B` ("` 
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
M9&4-" D ("` 9&5B=6< *#<I('5P9&%T961.97=,:6YK(#\ =W)I=&5F;&XH
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("` #0H ("` ("` ("` ?0T*("` ("` ("` (&5L<V4 >R`-"B` ("` ("` 
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*("` ("` ("` ("` 
M9&5B=6< *#<I(&9I>&5D(#\ =W)I=&5F;&XH(F9I>&5D(&QA9V=I;F< =&%I
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(&9I>"!L86=G:6YG('1A:6PB*3L-"B` ("` ("` ("!]#0H ("` ("` ('T-
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("` 9&5B=6< *#<I('5P9&%T961?;&%S="`_('=R:71E9FQN*")5<&1A=&5D
M(&QA<W0N(&QA<W0])7,B+&-A<W0H8V]N<W0H=F]I9"HI*6QA<W0I(#H =W)I
M=&5F;&XH(D9A:6QE9"!T;R!U<&1A=&4 ;&%S="(I.PT*("` ('T #0H ("` 
M#0H-"B` ("!S=&%T:6, 8F]O;"!$97%U975E*&]U="!086-K86=E(')E<W5L
M="D #0H ("` >PT*("` ("` 9&5B=6< *#<I(`T*("` ("` ("![#0H ("` 
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 
M<W5C8V5E9&5D+B(I.PT*("` ("` ("!]#0H ("` ("`-"B` ("` ('-H87)E
M9"!03F]D92!O;&1&:7)S=#L-"B` ("` ('L-"B` ("` ("` #0H ("` ("` 
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*3L ?0T*("` ("` ("`-"B` ("` ("` <VAA<F5D($A04F5C5'EP92!H<#$ 
M/2!(4%)E8U1Y<&4N06-Q=6ER92 I.PT*("` ("` ("!S8V]P92`H97AI="D 
M>R!(4%)E8U1Y<&4N4F5L96%S92AH<#$I.R!]#0H ("` ("` (`T*("` ("` 
M("!B;V]L(&AA=F5!9'9A;F-E9$9I<G-T(#T 9F%L<V4[#0H ("` ("` ('=H
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#0H ("` ("` ("` :68 *&]L9$9I<G-T("$](&9I<G-T*2!C;VYT:6YU93L-
M"B` ("` ("` ("!S:&%R960 4$YO9&4 ;VQD3&%S="`](&QA<W0[#0H ("` 
M("` ("` <VAA<F5D(%!.;V1E(&]L9$9I<G-T3F5X="`](&]L9$9I<G-T+FYE
M>'0[#0H ("` ("` ("` :'`Q+FAA>F%R9%\ /2!O;&1&:7)S=$YE>'0[#0H 
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:68 *&]L9$9I<G-T3F5X="!I<R!N=6QL*2![#0H ("` ("` ("` ("` ("` 
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.PT*("` ("` ("` ("` ?0T*("` ("` ("` ("` 96QS92![#0H ("` ("` 
M("` ("` (')E<W5L="`](&]L9$9I<G-T3F5X="YP:V<[#0H ("` ("` ("` 
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*2EO;&1&:7)S="D[#0H ("` ("!(4$Q&7T9R965,:7-T+D9R965.;V1E*&]L
M9$9I<G-T*3L-"B` ("` (')E='5R;B!T<G5E.R` ("`-"B` ("!]#0H ('T-
M"B` #0H-"B` 8VQA<W, 35!?1DE&3R`-"B` >R` ("`-"B` ("!S=&%T:6, 
M=F]I9"!I;FET:6%L:7IE*"D >WT-"B` ("!S=&%T:6, <W1R:6YG('-H;W)T
M7VYA;64H*2![(')E='5R;B`B35`L+$8B.R!]#0H ("` <W1A=&EC('-T<FEN
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
M8W110F]I;&5R<&QA=&4[#0H ("` #0H ("` <W1A=&EC('9O:60 16YQ=65U
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
M96EV97)?5&ED+'`I.PT*("` ("` 9&5B=6< *#<I('L =W)I=&5F;&XH(G-E
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=6< *#<I('L =W)I=&5F;&XH(E=A:71I;F< =&\ <F5C96EV93HB*3L ?0T*
M("` ("` ("!R96-E:79E*"A086-K86=E('!K9RD >R!P/7!K9SL ?2D[#0H 
M("` ("` (&1E8G5G(" W*2![('=R:71E9FQN*")R96,G9"$B*3L ?0T*("` 
M("` ("!R971U<FX =')U93L-"B` ("!]#0H ('T-"B` #0H ('-T<FEN9R!P
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
M86QU92QP+G-E;F1E<E]I9"QP+G-E;F1E<E]S97%U96YC92D[#0H ("` <F5T
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