<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { margin-top: 0 ; margin-bottom: 0 }
 --></style><title>Speed</title></head><body>
<div>I have a question about optimization.</div>
<div><br></div>
<div>I am helping a local candidate with their database. It is a large
county election database which I have imported into a field within
Rev.</div>
<div><br></div>
<div>This is a voter database in which we would like to identify a
single addresses for all voters within a given households so that we
do not have to send multiple letters to individual voters within the
same household. This makes a big difference in mailing costs.</div>
<div><br></div>
<div>I found that my original program runs prohibitively slowly.</div>
<div><br></div>
<div>But I find when I break up the data into smaller blocks, things
run much more rapidly. For example I use the following code:</div>
<div><br></div>
<blockquote><font face="Times" color="#000000"> </font><font
color="#000000"> repeat with k = 0 to 8</font></blockquote>
<blockquote><font color="#000000">    put line k*1000
to (k+1)*1000+1 of tField into temp</font></blockquote>
<blockquote><font color="#000000">    put
identifyUniqueAddresses(temp) into a[k]</font></blockquote>
<blockquote><font color="#000000">  end
repeat</font></blockquote>
<blockquote><br></blockquote>
<div>so that the data in the variable tField is broken up into 9
chunks of 1000 lines each. Later I reassemble the results from the
array, a[k].</div>
<div><br></div>
<div>If instead I try to run the whole field at once using:</div>
<div><br></div>
<div><x-tab>       
</x-tab>identifyUniqueAddressess(tField)</div>
<div><br></div>
<div>I would have to wait all day for the data in tField to
process.</div>
<div><br></div>
<div>(I have not found a was to use:</div>
<div><br></div>
<div><x-tab>        </x-tab>repeat
for each line tLine in tField</div>
<div><br></div>
<div>I have to be able to discover whether *successive* lines in the
sorted data share the same address.)</div>
<div><br></div>
<div>Now I'm sure my handler, identifyUniqueAddresess, is not the most
efficient code, but my question is this:  Why does the handler
run so much more rapidly working on several smaller chunks which are
later reassembled rather than all at once? </div>
<div><br></div>
<div>I suspect the problem may be successively pulling up lines of
text from a very long list of lines. Would it help if I first put the
lines into an array and then worked with the array?</div>
<div><br></div>
<div>Is there an optimizer out there? Gentlemen and gentle ladies,
start your engines.</div>
<div><br></div>
<div> </div>
<div><br></div>

<div>-- <br>
Jim Hurley</div>
</body>
</html>