LC vs mySQL

jbv at jbv at
Sat Dec 7 11:37:01 EST 2013

Hy list,

Since I started using LC (actually MC) ages ago, especially as an engine
on a server, I've been trying to have my scripts run as fast as possible,
and often tried both options : complex SQL requests that select and
shape the data for optimum use in LC, or raw data "downloaded" from the
DB followed by processing in LC.

In a script of my current project, I have 8 * 35 = 280 requests to mySQL
to a DB of about 80000 entries, each request featuring a "where" condition
involving 5 to 10 parameters (and sometimes conditions such as
myCol = 125 OR myCol = 387 OR myCol = 547 OR myCol = 1205 ...)

Even by carefully building my tables with indexes, I was unable to drop
execution time of my script below 1890 ms.

By lowering the number of mySQL requests (for instance by getting in 1 shot
all the entries to process) and processing them with several arrays through a
few nested loops, I was able to run my script in only 315 ms (which is
perfect for
ajax type projects requiring realtime responses from the server).

Of course, the drawback is that the LC code is a bit harder to read than a
succession of SQL requests. Anyway in most cases the advantage goes to
raw data in LC.
I'm not sure if the above requires any further comments, but I'm curious
about how
you guys approach that problem (if there's any)...

Al the best

More information about the Use-livecode mailing list