Which is better/faster/more efficient in Developer Help
|
|
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!
|
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.