<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Marcel,<div><br></div><div>I am not opposed to your suggestion. However I would like to point out that in VIFF you compute on shares and not field elements!. Computing directly on the field elements is hacking the abstractions of VIFF.&nbsp;</div><div>Computation on field elements or rather the representation of a Share can be useful as an optimization, however this optimization should be confined within applications or runtimes, and should not progress over interface boundaries as I fear you are suggesting.</div><div>&nbsp;</div><div><br><div><div><div>On 08/10/2009, at 20.11, Marcel Keller wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dear friends of VIFF,<br><br>I have a proprosal to optimize preprocessing in VIFF, which I would like to put up for discussion.<br><br>Notation:<br>- D(x): a Deferred object whose callback function will be called with x<br>- S(x): same for a Share object<br>- F: a FieldElement object<br>- [x, ...]: a Python list<br>- (x, ...): a Python tuple<br><br>Current situation:<br>The two generate_triples() functions in the active runtimes return<br>n, D([(S(F), S(F), S(F)), ...]),<br>where n denotes the length of the list. Runtime.preprocess() puts one D(S(F), S(F), S(F)) per program counter in the preprocessing pool and uses util.deep_wait() to return a Deferred whose callback is called when all field elements are available.<br><br>The get_triple() functions return<br>D(S(F), S(F), S(F)),<br>either taken from the preprocessing pool, or by calling generate_triples() and adding an extra callback to extract the first triple.<br><br>My proposal:<br>The generate_triples() functions return<br>[D([F, F, F]), ...],<br>and Runtime.preprocess() puts one [F, F, F] per program counter in the preprocessing pool. There is no need for deep_wait, we can just use gatherResults on the Deferreds return by the generator functions. The generator functions can use gatherResults to get D([F, F, F]) from [S(F), S(F), S(F)].<br><br>The get_triple() functions return<br>[F, F, F], True &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if there is a triple in the pool, and<br>[S(F), S(F), S(F)], False &nbsp;&nbsp;&nbsp;otherwise.<br>For the multiplication in BasicActiveRuntime it doesn't make a difference whether FieldElements or Shares are returned. Future applications which require Shares can wrap the FieldElements in Shares if the Boolean is True.<br><br>Benchmarks:<br>- 10000 multiplications in parallel with active security using PRSS<br> &nbsp;- 4% faster preprocessing<br> &nbsp;- 5% faster online operation<br> &nbsp;- 50 MB less memory used<br>- 10 AES blocks in parallel using masked exponentiation with active security using PRSS<br> &nbsp;- 10% faster preprocessing<br> &nbsp;- 10% faster online operation<br> &nbsp;- 140 MB less memory used<br><br>Further considerations:<br>- I don't see any problem for replacing FieldElement with anything that does not contain Deferreds in any form.<br>- Probably, it would also be possible to leave the generator functions as they are and use something similar to deep_wait(). However, I consider it as an overhead.<br>- One could also always wrap the FieldElements in Shares, but this would again be an overhead.<br><br>Best regards,<br>Marcel<br>_______________________________________________<br>viff-devel mailing list (<a href="http://viff.dk/">http://viff.dk/</a>)<br><a href="mailto:viff-devel@viff.dk">viff-devel@viff.dk</a><br>http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk<br></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial" size="2"><b><font class="Apple-style-span" color="#f05a23">____________________________________________________</font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><b><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23"><br></font></font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><b><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23">Janus Dam Nielsen</font></font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; min-height: 8px; "><font class="Apple-style-span" face="Arial"><b><font class="Apple-style-span" size="2"><br></font></b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span class="Apple-style-span" style="font-family: Arial; font-size: 10px; font-weight: bold; "><font class="Apple-style-span" color="#5a5a5a">Research and Innovationspecialist, PhD.</font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-family: Helvetica; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">CENTRE FOR IT-SECURITY</font></font></font></div></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"><br></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span class="Apple-style-span" style="font-family: Helvetica; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">THE ALEXANDRA INSTITUTE LTD.</font></font><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"> </font></font></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; min-height: 8px; "><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-family: Helvetica; "><div><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"><br></font></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span style="letter-spacing: 0.1px; "><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">T</font></font></font><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a"> </font></font></font></span><font class="Apple-style-span" face="Arial"><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">+45 42 22 93 56</font></font></font></span></div><div><font class="Apple-style-span" color="#5A5A5A" face="Arial" size="2"><span class="Apple-style-span" style="font-size: 10px; ">E<span class="Apple-converted-space">&nbsp;</span><span class="Apple-style-span" style="color: rgb(240, 90, 35); "><a href="mailto:janus.nielsen@alexandra.dk">janus.nielsen@alexandra.dk</a></span></span></font></div><div><span class="Apple-style-span" style="color: rgb(213, 61, 33); font-family: Arial; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#5a5a5a">W</font></font><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" size="2"> </font></span><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23">alexandra.dk</font></font></span></div></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Nuri; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7px; line-height: normal; "><span class="Apple-style-span" style="font-family: Arial; font-weight: bold; "><font class="Apple-style-span" size="2"><font class="Apple-style-span" color="#f05a23">____________________________________________________</font></font></span></div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span> </div><br></div></div></body></html>