Re: Consulting a memfile

Paulo Moura <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Hi Jan,

On 10/10/2013, at 08:57, Jan Wielemaker <[email protected]> wrote:

> On 10/10/2013 01:00 AM, Paulo Moura wrote:
>> (2) how fast creating/writing to a memory file and then consulting it
>> would be compared to create, write to, and consult an ordinary
>> temporary file.
> 
> I'd typically expect the memory file solution to be quicker on smallish
> amounts of data. On larger amounts, the file creating overhead should
> typically be neglectable.

That was also my expectation and a few experiments seem to confirm it. But there's another aspect of performance here that I have not yet tested: creating a large file by writing terms to it one by one. Ordinary file buffering may get in the way, however, making results less predictable, specially across operating-systems. Not sure.

> Of course, tmp file handling performance
> varies widely between OSes.  Memory files should be more predictable.
> So, if the amount of memory is not an issue, I'd use memory files for
> temporary stuff that only needs to be written and read by the same
> Prolog process.

Another advantage would be to avoid worries about lack of file-system permission to create the temporary files.

Thanks for the feedback. Cheers,

Paulo

-----------------------------------------------------------------
Paulo Moura
Logtalk developer

Email: <mailto:[email protected]>
Web:   <http://logtalk.org/>
-----------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.