Arrays vs databases

Paul Looney simplsol at
Fri May 20 16:33:14 EDT 2016

> On May 20, 2016, at 12:47 PM, Bob Sneidar <bobsneidar at> wrote:
> If there were a way to "query" an array which returned another array with matching keys, that would be okay. But I cannot search an array right now, so as a database for finding information, it's not all that great. Oh sure, I can write repeat loops to go through every single key to find the ones I need, but I would have to write the logic for all that. Ick! Why not just use a memory based database, or even an sqLite database? I just do not see the point to using arrays as a database when there are single and multiuser solutions all over the place.

One answer is that, with “LSON”, you can do all of your work with LC and a text file db. There is no need to learn the (often arcane) syntax of a DBMS.

Repeat loops in LC are often “fast enough”. This morning I was working on a project that has a database of over 6,000 records in a 15 MB file text file. This text file was already stored in RAM as an array. I wanted to retrieve some names from line 2 of a field (so it included a chunk expression). Here are the benchmark timings:

Process times (in milliseconds) 
Get data from server: 78
Prep data, process chunks: 2
Build array for deleting duplicates: 2
Delete duplicates: 0
Sort list: 0
Load fields: 0
Total: 83

That is over 72,000 records per second. I’m using a five year old MacBook Pro (2.2 Ghz Sandybridge Core i7). And the code is not optimized. You will notice that three steps in the process were too fast to time with milliseconds.

This speed is certainly sufficient for much work.

Paul Looney

BTW, My text file db is multiuser.

More information about the Use-livecode mailing list