<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=Generator content="Microsoft Word 12 (filtered medium)">
<STYLE><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
..MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></STYLE>
</HEAD>
<BODY lang=EN-NZ dir=ltr link=blue vLink=purple>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Currently its about 0 to 170, but may expand in future, so a byte array
could be used as well at least at present. I will run a test on both
byte and word and integer to see. If its only a second or two its
fine. And there are no pointers, otherwise I wouldn’t even consider
it.</DIV>
<DIV> </DIV>
<DIV>I thought there must be some simple way to do it with Filestream, only I
haven’t done it with binary data like this (I didn’t plan for needing this when
I designed it)</DIV>
<DIV> </DIV>
<DIV>I can live with the 40-50 seconds delay, but on PCs with a slow processor
it might create timing problems if it is much longer as it has to finish before
other stuff kicks off.</DIV>
<DIV> </DIV>
<DIV>I am also looking at the algorithm that takes that long, there might be
something iffy in there. There is a loop within the loop doing the
calculations and that can be a minefield.</DIV>
<DIV> </DIV>
<DIV>Thanks to Russell at al for all the suggestions.</DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=ross@stationplaylist.com
href="mailto:ross@stationplaylist.com">Ross Levis</A> </DIV>
<DIV><B>Sent:</B> Monday, July 7, 2014 10:14 PM</DIV>
<DIV><B>To:</B> <A title=delphi@listserver.123.net.nz
href="mailto:delphi@listserver.123.net.nz">'NZ Borland Developers Group - Delphi
List'</A> </DIV>
<DIV><B>Subject:</B> Re: [DUG] Saving aray</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV class=WordSection1>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d'>Shame it’s not 0 to
255. You could then use an array of byte and write them as bytes to a
binary file. It would only be 1.5MB in size so very small and I guess take
less than a second to load and save.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d'><o:p></o:p></SPAN> </P>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d'>If you do really
need 257 possible values (0-256) then an array of Word is 2 bytes per value and
it would be 3MB in size. Still a very small file.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d'><o:p></o:p></SPAN> </P>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d'>Writing and reading
the array may be possible by dumping the RAM direct to file in bulk and loading
it back. There will be some way of doing that I believe and it should very
fast.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: #1f497d'><o:p></o:p></SPAN> </P>
<DIV>
<DIV
style="BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; PADDING-BOTTOM: 0cm; PADDING-TOP: 3pt; PADDING-LEFT: 0cm; BORDER-LEFT: medium none; PADDING-RIGHT: 0cm">
<P class=MsoNormal><B><SPAN lang=EN-US
style='FONT-SIZE: 10pt; FONT-FAMILY: "Tahoma","sans-serif"'>From:</SPAN></B><SPAN
lang=EN-US style='FONT-SIZE: 10pt; FONT-FAMILY: "Tahoma","sans-serif"'>
delphi-bounces@listserver.123.net.nz
[mailto:delphi-bounces@listserver.123.net.nz] <B>On Behalf Of </B>John
Bird<BR><B>Sent:</B> Monday, 7 July 2014 8:35 p.m.<BR><B>To:</B> NZ Borland
Developers Group - Delphi List<BR><B>Subject:</B> [DUG] Saving
aray<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p></o:p> </P>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal><SPAN
style='FONT-SIZE: 10pt; FONT-FAMILY: "Tahoma","sans-serif"; COLOR: black'>I have
a program that builds a very large array (over 1,500,000) of integers, and the
calculation to fill the array takes quite a while – around 40-50
secs. If there is a quick way to do it, I would save the array to
disk if it was faster than recalculating it the next time.</SPAN><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: black'><o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: black'> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style='FONT-SIZE: 10pt; FONT-FAMILY: "Tahoma","sans-serif"; COLOR: black'>I am
guessing that writing the elements to strings and using CSV etc would be quite
slow, as it involves quite a lot of processing. I will run a test to
see.</SPAN><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: black'><o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: black'> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style='FONT-SIZE: 10pt; FONT-FAMILY: "Tahoma","sans-serif"; COLOR: black'>Is
there any really fast way to save such an array to disk? The numbers
range between 0 and 256 if that helps.</SPAN><SPAN
style='FONT-FAMILY: "Calibri","sans-serif"; COLOR: black'><o:p></o:p></SPAN></P></DIV></DIV></DIV></DIV>
<P>
<HR>
_______________________________________________<BR>NZ Borland Developers Group -
Delphi mailing list<BR>Post: delphi@listserver.123.net.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@listserver.123.net.nz with Subject:
unsubscribe</DIV></DIV></DIV></BODY></HTML>