ID:154706
 
Hey there, got a quick question. Say I have a directory of around 2000 items, with each item containing a list of properties. Would I be better off saving and then loading the item like this:
proc
saveitem(name, data[])
fdel( "database/[name]" )
text2file( list2params(data), "database/[name]")

readitem(name)
if( fexists("database/[name]") )
return params2list( file2text("database/[name]") )


or like this:
proc
saveitem( name, data )
var/savefile/f = new( "database/[name]" )
f << data

readitem( name )
if( fexists("database/[name]") )
. = new/savefile("database/[name]")
. >> .


The reason I'm asking is because I'm writing a function to search through all the items and of course the less resource use/more speed the better!
If you're accessing them all at once, it might make more sense to load them all at once (as in, put them in the same file).

As for what runs faster, the quickest way to figure that out is to try it yourself. Run each of them 2000 times while profiling and see which of 'em wins.
In response to DarkCampainger
Ah, right! I realize now I've been doing this really stupidly. xD
One of my goals was to keep the number of lists in memory to a minimum but then again, the speed difference makes reading from hdd a very obviously poor solution, so all at once it is then! Thank you! :)