<br><br>
<div class="gmail_quote">On Wed, Aug 5, 2009 at 1:50 PM, Sasha Khapyorsky <span dir="ltr"><<a href="mailto:sashak@voltaire.com" target="_blank">sashak@voltaire.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>On 13:03 Wed 05 Aug , Hal Rosenstock wrote:<br>> ><br>> > Thinking more about this I suppose that an original structure is good<br>> > enough for doing what you need without intermediate buffers. It could be<br>
> > something like this:<br>> ><br>> > qsort(index....);<br>> ><br>> > for (i = 0; i < num_switches; i++)<br>> > lash->switches[index[i].index]->id = i;<br>
> ><br>> > for (i = 0; i < num_switches; i++) {<br>> > s = lash->switches[i];<br>> > for (j = 0; j < s->num_links; j++)<br>> > s->links[j]->switch_id =<br>
> > lash->switches[s->links[j]->switch_id]->id;<br>> > }<br>> ><br>> > for (i = 0; i < num_switches; i++) {<br>> > s = lash->switches[i];<br>
> > while (s->id != i) {<br>> > s1 = lash->switches[s->id];<br>> > lash->switches[s->id] = s;<br>> > s = s1;<br>
> > }<br>> > }<br>> ><br>> > Would it work?<br>><br>><br>> Even if something like this works (haven't played with it yet), is it worth<br>> iterating over lash->switches array to save a memory allocation ?<br>
<br></div>It is single pass finally - just put everything in the places. I don't<br>think that this introduces more calculations than the original code did.</blockquote>
<div> </div>
<div>I'll work on in it the background (and note this in the updated patch description).<br> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div><br>> Also, couldn't this be a subsequent<br>> step in the evolution of this code ?<br><br></div>Yes, I think it could.</blockquote>
<div> </div>
<div>Good; I'll resubmit a slightly updated version shortly.</div>
<div> </div>
<div>-- Hal</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span></span><br><font color="#888888"><br>Sasha<br></font></blockquote></div><br>