Darryl Collins
darryl at whittleconsulting.com.au
Mon Aug 1 20:09:07 CDT 2011
Hah, I just noticed that as I reordered the sequence to see what would
happen and got a different results that I was expecting. On the new
function the results are much tighter, indeed only the rs(1) syntax is
faster - and then only by a second.
1000000 iterations on FieldNum: Finished in 0.9804688 seconds
1000000 iterations on Literal: Finished in 1.820313 seconds
1000000 iterations on Bang: Finished in 1.894531 seconds
Cheers
Darryl.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Tuesday, 2 August 2011 10:48 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] rsR("order") vs rsR!Order
I messed that one up. It should have been:
Function test()
Dim t1 As Single
Dim t2 As Single
Dim x As Long
Dim tests As Long
tests = 1000000
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Set rs1 = CurrentDb.OpenRecordset("Table1")
Set rs2 = CurrentDb.OpenRecordset("Table2")
rs1.AddNew
t1 = Timer
For x = 1 To tests
rs1(1) = rs2(1)
Next
t2 = Timer
Debug.Print tests & " iterations on FieldNum: Finished in " & t2 - t1 & "
seconds"
t1 = Timer
For x = 1 To tests
rs1("field1") = rs2("field1")
Next
t2 = Timer
Debug.Print tests & " iterations on Literal: Finished in " & t2 - t1 & "
seconds"
t1 = Timer
For x = 1 To tests
rs1!field1 = rs2!field1
Next
t2 = Timer
Debug.Print tests & " iterations on Bang: Finished in " & t2 - t1 & "
seconds"
1000000 iterations on FieldNum: Finished in 1.652344 seconds
1000000 iterations on Literal: Finished in 2.816406 seconds
1000000 iterations on Bang: Finished in 2.730469 seconds
Which suggests that Jim was mistaken when he said:
"All the bang/dot notation internally is converted
to that format before being executed."
--
Stuart
On 2 Aug 2011 at 10:33, Stuart McLachlan wrote:
> You don't even need large table to test the relevant part. Just two
> tables with at least one record in one of the tables:
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com