SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: Bern Ertl on April 09, 2015, 10:56:05 am

Title: slF vs. slFN
Post by: Bern Ertl on April 09, 2015, 10:56:05 am
I have a section of code that is reading data from a remote db and populating a grid control.  The performance is not where I want it to be currently, so I'm tweaking things trying to optimize it.

This section of code is "generic" in that it can be called from different points with different criteria on what fields (db columns) need to be read/loaded.  I'm using a bit array to designate which fields/columns should be included.  The code builds the SELECT statement based upon which bits/columns are true/selected.

As such, the field position for a given column may change depending upon the selection criteria.  I was using slFN with column names to keep the code simple and clear.

But when I added a bunch of code to index the positions of each selected column and then use slF instead of slFN, I saw a roughly 30% speed increase over my modest test data.

This is just an FYI.  I knew that slFN added some extra processing to find the column position, but I didn't expect it to be that significant.
Title: Re: slF vs. slFN
Post by: cj on April 09, 2015, 11:41:43 am
I have never needed slFn or used it since I normally place all data into arrays.

For any lurkers the column names are easily obtained in element 0 of slSelAry or using slGetcolumnName(column.)

30%, thanks for the info, Bern!




Title: Re: slF vs. slFN
Post by: Bern Ertl on April 10, 2015, 09:52:30 am
slSelAry is slower than using slSel and slF to process recordsets:

http://www.sqlitening.com/support/index.php?topic=3251.msg16559#msg16559