Re: Resource file
From: Ralph (nt_consulting64_at_address.com)
Date: 09/07/04
- Next message: MikeD: "Re: Load/Unload events"
- Previous message: Jeff Johnson [MVP:VB]: "Re: Problem solved :-)"
- In reply to: J French: "Re: Resource file"
- Next in thread: Gaurav - http://www.gauravcreations.com: "Re: Resource file"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 6 Sep 2004 21:26:05 -0500
"J French" <erewhon@nowhere.com> wrote in message
news:413c6b35.106916318@news.btclick.com...
> On Mon, 6 Sep 2004 07:58:33 -0500, "Norm Cook"
> <normcookNOSPAM@cableone.net> wrote:
>
> >When you you use a resource file, it is compiled into your exe.
Therefore, when
> >you run your compiled exe, the exe, along with the resources, get loaded
into
> >memory. Thus accessing your resources is memory access which is the
fastest
> >and most efficient access--as opposed to registry, ini file, database, or
file access.
> >
>
> <snip>
>
> Are you absolutely sure that resources are loaded into memory ?
> ie: mapped in with the EXE code and data
>
> That strikes me as rather daft, as the whole point of using them is
> supposed to be to /save/ memory.
>
>
When it comes to defining "loaded into memory" it can get rather
complicated, as what we are really talking about is "memory-mapping" into
Virtual Memory Management. The Win32 "program loader" memory-maps the PE
file format into virtual memory, for example. However, the entire program
and all its code and data is seldom actually in "memory" at any one moment.
Different resources datatypes are even "loaded" (memory-mapped) by slightly
different means. Bitmaps generally show up as single "blocks". Dialog
resources are used to "Read in" instructions on how to build something - the
resource itself doesn't 'stick around'. StringTables are managed thru a
manager that first loads the IDs which are 'mapped' to the various strings,
which may only be actually "in-memory" in 4k(8k) chunks. An API request for
a string ID, "loads" that particular chunk. The chunks may stick around or
be paged out frequently depending on the over-all load on the machine - as
the whole process is still dependent on the Platform's Virtual Memory
management.
Basically all Norm was pointing out was that loading strings from a resource
is generally faster than using File I/O - which is the same as saying
memory-mapped files are 'fetched' quicker than going to the disk. This is
one of the advantages of using a resource data file.
There is, however, always a trade-off. Loading an extremely large
stringtable and randomingly fetching values from it can sometimes be slower
than loading a single file and parsing it like an array. Like everything
else in computing - whenever you get to the 'outer limits', or the edges of
the envelope, of any technology, you need to test and see what the results
are in YOUR problem domain.
-ralph
- Next message: MikeD: "Re: Load/Unload events"
- Previous message: Jeff Johnson [MVP:VB]: "Re: Problem solved :-)"
- In reply to: J French: "Re: Resource file"
- Next in thread: Gaurav - http://www.gauravcreations.com: "Re: Resource file"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|