Relative speed of types of storage
dochawk at gmail.com
Sat Oct 5 11:55:24 EDT 2013
As I add and update, I keep wondering about relative speeds of ways of
storing and retrieving data.
It starts with the data in memory. I have about 500 text keys, and several
fields for each.
I coded these to a two dimensional array, and then to an in-memory sqlite
database. At first I assumed the array would be faster, but recoded over
the convenience of queries with "WHERE", "ORDER BY", and so forth--for
which I assume sqlite will dance circles around flipping through the
entries in a loop.
A lot of assuming . . .
(And I expect there would be a couple of orders of magnitude of speedup if
I did this in C or Fortran, where I could turn my keys into numerical
constants and have instant array lookup instead of sorting through keys . .
. at the cost of half or two thirds an order of magnitude increase in
coding time . . .)
And then there's data for a stack. I used to keep things in invisible
fields, and just found another couple of those. Surely variables are
faster. But how does setting or reading a variable compare speedwise with
reading a global array (again, I'm sure it's slower than a variable
AN dos forth . . .
Dr. Richard E. Hawkins, Esq.
More information about the Use-livecode