I was playing this morning with my galleries database. The gallery_info procedure makes two calls to the database. One if speedy. The other is slow. WAY TOO SLOW and I make that call every single time the script runs. I use roughly the same procedure in both the admin (edit) scripts and in the public (display only) scripts.
The data it returns is static in the public scripts. it never changes. And it is coming back out of the database. I'll have the edit scripts write out a flat file (no more than 200 lines) that contain the four bits of information I need. Reading that file into the script and parsing the lines is fast.
I see no way to speed up the slow gallery_info query.
I'm reading the lines in and creating a list of lists. I like those, but they seem a little difficult to manipulate: "lindex [lindex $index 0] 0]" gets me the first item in the inside list from the first item in the master list. That will be a lot of calls to lindex.
Also, I keep forgetting that "read" doesn't get a line. To get a line, I have to "split [read file] \n]. I don't mess with files enough to remember that.
Creating the list of lists looks like this:
Then getting the data from the first object looks something like this:
The data it returns is static in the public scripts. it never changes. And it is coming back out of the database. I'll have the edit scripts write out a flat file (no more than 200 lines) that contain the four bits of information I need. Reading that file into the script and parsing the lines is fast.
I see no way to speed up the slow gallery_info query.
I'm reading the lines in and creating a list of lists. I like those, but they seem a little difficult to manipulate: "lindex [lindex $index 0] 0]" gets me the first item in the inside list from the first item in the master list. That will be a lot of calls to lindex.
Also, I keep forgetting that "read" doesn't get a line. To get a line, I have to "split [read file] \n]. I don't mess with files enough to remember that.
Creating the list of lists looks like this:
foreach line [split [read $file_handle] \n] {lappend index [split $line | ] }Then getting the data from the first object looks something like this:
set name [lindex [lindex $index 0] 0]
set fp [lindex [lindex $index 0] 1]
set vis [lindex [lindex $index 0] 2]
set caption [lindex [lindex $index 0] 3]