Memory mapping - Mozilla

This is a discussion on Memory mapping - Mozilla ; Is it possible to map a file to memory from Javascript. I need this for my extensions. Or do I have to use XPCOM? If so how?...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Memory mapping

  1. Memory mapping

    Is it possible to map a file to memory from Javascript. I need this
    for my extensions. Or do I have to use XPCOM? If so how?

  2. Re: Memory mapping

    On 6 Apr., 19:40, Benjamin Smedberg wrote:
    > On 4/6/09 11:50 AM, Zorkzero wrote:
    >
    > > Is it possible to map a file to memory from Javascript.

    >
    > No.


    It's a pity. I hate XPCOM.

    > > I need this
    > > for my extensions. Or do I have to use XPCOM? If so how?

    >
    > You can use NSPR PR_MemMap.


    Are there any examples, which are easy to understand?

    > What do you need memory mapping for? Could you make do with standard file
    > I/O, which is available using pure JS?


    I'm writing a dictionary application for Firefox. It needs to load a
    binary index for every dictionary file and loading of a single index
    takes 30 seconds. This means, that if the user has multiple
    dictionaries the first search can take minutes and the browser becomes
    unresponsive.

    The only solution I found is to write the index to a SQLite database
    and use it. The problem with this is that the index file becomes much
    bigger, 15 MB instead of 6 MB. That's almost 3 times bigger. I know
    that disk space is very cheap, but still this seems completely
    unnecessary.

+ Reply to Thread