Page 1 of 2

Performance of getkey & setkey

Posted: 15 Feb 2013 12:07
by Marco
I was wondering if calling getkey two times on the same ini file triggers a read action twice.
If so, maybe that could be improved allowing getkey to work on variables containing the ini file, so that all operations are done in ram.
Same for setkey...

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 13:10
by PeterH
That is: you explicitely want to read/write the file to/from variable, and getkey/setkey should allow to specify the variablename instead of the filename?

PS: thinking about this it seems it would be of use for me, too!

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 13:16
by Marco
Getkey/setkey should allow to operate on a variable stored in ram instead that an ini file on disk. A variable that contains what an ini file contains, of course.
Benefit: no disk i/o operations apart from the very first read (file to memory) and the very last write (memory to file). You would also save cell life on SSD.

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 13:37
by highend
You would also save cell life on SSD.
*g* A good SSD should allow 60 TB+ writes so I hope it doesn't die from writing config files :)

+1 for this feature wish!

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 16:14
by admin
Forget it. Impossible.

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 18:36
by PeterH
Just for info...

I thought 60 times (different) setkey-commands to xyplorer.ini would be a bit of work. But as I see it this is done in about 1 sec! (Maybe faster: date('hh:mm:ss') often sees the same second before and after.) I'd say it's hardly to notice...

So for me it's okay how it works now :D

I think it would only be interesting if you either have much more setkey to the same file, or a much bigger ini-file.
Just for interest: does somebody have?

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 18:40
by admin
You could also read the file and parse it yourself.

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 18:46
by PeterH
admin wrote:You could also read the file and parse it yourself.
Try to emulate $value = getkey($key, $sect, $file); (or alike) with a script. :?
So we would need functions, parameters, and return values :P

And I don't know how fast this could be then :?:

Re: Performance of getkey & setkey

Posted: 15 Feb 2013 18:51
by Marco
PeterH wrote:Just for info...

I thought 60 times (different) setkey-commands to xyplorer.ini would be a bit of work. But as I see it this is done in about 1 sec! (Maybe faster: date('hh:mm:ss') often sees the same second before and after.) I'd say it's hardly to notice...

So for me it's okay how it works now :D

I think it would only be interesting if you either have much more setkey to the same file, or a much bigger ini-file.
Just for interest: does somebody have?
I don't have big ini files to test, but maybe there's some underlying caching, who knows...

SC getkey(): support for "memory-mapped" INI-"files"?

Posted: 21 Jul 2014 20:40
by Filehero
Hi Don,

I wonder how much effort it would be to make SC getkey() supporting "INI-files in memory" (sorry, havent't found better words for it)?

I mean something like

Code: Select all

$INI = <<<INI
[Name]
first_name=File
name=Hero
INI;

  msg(getkey("first_name", "Name", "$INI"));
Though this "idea" comes from thinking about establishing a more "typed" way for passing back results when using SC runret(), wouldn't it in the end be nothing else then a simple implementation of Hashmaps/Dictionaries?

Hmm...


Cheers,
Filehero

Re: SC getkey(): support for "memory-mapped" INI-"files"?

Posted: 21 Jul 2014 21:17
by Marco
I asked the same roughly one year ago, but the answer wasn't positive. I hope time has changed in a good way...

Re: SC getkey(): support for "memory-mapped" INI-"files"?

Posted: 21 Jul 2014 21:29
by Filehero
Hi Marco,
Marco wrote:I asked the same roughly one year ago, but the answer wasn't positive. I hope time has changed in a good way...
did you find the link to that old post?

Re: SC getkey(): support for "memory-mapped" INI-"files"?

Posted: 21 Jul 2014 21:30
by TheQwerty
Filehero wrote:Hi Marco,
Marco wrote:I asked the same roughly one year ago, but the answer wasn't positive. I hope time has changed in a good way...
did you find the link to that old post?
It's the same as the one you posted in. ;)

EDIT: Although now I'm having doubts about the merger since the topic is really about performance. :?

Re: SC getkey(): support for "memory-mapped" INI-"files"?

Posted: 21 Jul 2014 21:34
by Filehero
TheQwerty wrote:EDIT: Although now I'm having doubts about the merger since the topic is really about performance. :?
I do share your doubts. :mrgreen:

Re: Performance of getkey & setkey

Posted: 21 Jul 2014 21:37
by admin
No, time has not changed anything: forget it. :)