April 4th, 2007, 12:13 pm
Two cheeky comments for what they're worth:1)Dim x(N) as double ..would only work is you know up front how many elements you're going to have. I guess in the given example you may not always know this.2)Have you tried using ADO for this? It's much better suited for sets of data this size.I've just run the following test using an ADO recordset, creating 3,921,225 recordsets (cotaining 5 doubles) takes around 1/2GB memory this way. Also, you get quick sorting (sorting that's quick, not a quicksort, that is) for relatively little cost (takes around 2 secs + 50 MB to sort on any given field). Building the data took a minute or so on my box (3GHz x2 Hyperthreaded Xeon w/2 GB RAM)Sub test() Dim a As ADODB.Recordset Set a = New Recordset Dim i,j,arr For i = 1 To 5 a.Fields.Append "Field" & i, adDouble Next a.Open arr = Array("Field1", "Field2", "Field3", "Field4", "Field5") For j = 1 To 3921225 a.AddNew arr, Array(Rnd(), Rnd(), Rnd(), Rnd(), Rnd()) NextEnd Sub