473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

File map performance

Hello everyone,
I have several physical file and I want to use file map
(MapViewOfFileEx) to map the file into memory to improve performance.
Each file is about several hundred M bytes. All the memory mapped
files are kept open during my application.

The mapping is successful, but the strange thing is,

1. the performance to access the files which are opened at first is
very fast;
2. the performance to access the files which are opened later is
slower and slower (the performance to access the 10th file is very
bad).

Any ideas to improve performance?
thanks in advance,
George
Jan 2 '08 #1
6 3140
George2 wrote:
I have several physical file and I want to use file map
(MapViewOfFileEx) to map the file into memory to improve performance.
....whatever "file map" is...
Each file is about several hundred M bytes. All the memory mapped
files are kept open during my application.

The mapping is successful, but the strange thing is,

1. the performance to access the files which are opened at first is
very fast;
2. the performance to access the files which are opened later is
slower and slower (the performance to access the 10th file is very
bad).

Any ideas to improve performance?
You need to ask in the newsgroup where "file map" is on topic. It is
not a feature of the language, it's a feature of your OS.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 2 '08 #2
George2 wrote:
Hello everyone,
I have several physical file and I want to use file map
(MapViewOfFileEx) to map the file into memory to improve performance.
Each file is about several hundred M bytes. All the memory mapped
files are kept open during my application.

The mapping is successful, but the strange thing is,

1. the performance to access the files which are opened at first is
very fast;
2. the performance to access the files which are opened later is
slower and slower (the performance to access the 10th file is very
bad).

Any ideas to improve performance?
It sounds like you are running into disk swapping and/or thrashing issues.
Physical memory is limited (1GB 2GB is common) and is shared amoung
programs, the operating system, etc... As you request memory from the OS it
allocates the memory. :The more memory you request the more that gets
swapped to disk.

So basically what it sounds like is happening, you load a file into memory,
and keep loading files. The memory starts to get swapped to disk. As you
go back and read the memory the OS has to read it from the disk swap file
and write other memory to the swap file for what it's replacing. So now
instead of saving time from reading a file once, it has to write and read.

Several hundred MB of many files is too much to keep in physical memory at
one time. I'm thinking it may actually be faster to read the files as
needed counting on the OS's own file buffering to reduce physical disk I/O.

--
Jim Langston
ta*******@rocketmail.com
Jan 2 '08 #3
On Jan 2, 9:06 pm, George2 <george4acade...@yahoo.comwrote:
Hello everyone,

I have several physical file and I want to use file map
(MapViewOfFileEx) to map the file into memory to improve performance.
Each file is about several hundred M bytes. All the memory mapped
files are kept open during my application.

The mapping is successful, but the strange thing is,

1. the performance to access the files which are opened at first is
very fast;
2. the performance to access the files which are opened later is
slower and slower (the performance to access the 10th file is very
bad).

Any ideas to improve performance?

thanks in advance,
George
Are you using mmap() and does your operating system support virtual
memory?
What is your objective and what kind of application are you developing?
Jan 2 '08 #4
>
Several hundred MB of many files is too much to keep in physical memory at
one time. I'm thinking it may actually be faster to read the files as
needed counting on the OS's own file buffering to reduce physical disk I/O.

--
Jim Langston
tazmas...@rocketmail.com
I really wonder how OS's own file buffering would improve performance
for the OP's scenario...
after all, it too would need to load the contents of the file into the
memory right? So i would imagine the same performance issues with OS's
mechanisms too...

may be the op's application can't read from a file but instead only
from the memory with the help of a pointer to the buffer...
I have faced some third party applications, which accepts data only in
a buffer and not in a file... i used mmap() in those case...
Jan 2 '08 #5
Rahul wrote:
>Several hundred MB of many files is too much to keep in physical
memory at one time. I'm thinking it may actually be faster to read
the files as needed counting on the OS's own file buffering to
reduce physical disk I/O.

--
Jim Langston
tazmas...@rocketmail.com

I really wonder how OS's own file buffering would improve performance
for the OP's scenario...
after all, it too would need to load the contents of the file into the
memory right? So i would imagine the same performance issues with OS's
mechanisms too...

may be the op's application can't read from a file but instead only
from the memory with the help of a pointer to the buffer...
I have faced some third party applications, which accepts data only in
a buffer and not in a file... i used mmap() in those case...
Because then the OS would only have to buffer it once. Not the OS buffering
it, and him buffering it as is the current case. It depends on how well the
OS buffers files.

--
Jim Langston
ta*******@rocketmail.com
Jan 2 '08 #6
On Jan 2, 10:47 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
Rahul wrote:
Several hundred MB of many files is too much to keep in physical
memory at one time. I'm thinking it may actually be faster to read
the files as needed counting on the OS's own file buffering to
reduce physical disk I/O.
--
Jim Langston
tazmas...@rocketmail.com
I really wonder how OS's own file buffering would improve performance
for the OP's scenario...
after all, it too would need to load the contents of the file into the
memory right? So i would imagine the same performance issues with OS's
mechanisms too...
may be the op's application can't read from a file but instead only
from the memory with the help of a pointer to the buffer...
I have faced some third party applications, which accepts data only in
a buffer and not in a file... i used mmap() in those case...

Because then the OS would only have to buffer it once. Not the OS buffering
it, and him buffering it as is the current case. It depends on how well the
OS buffers files.

--
Jim Langston
tazmas...@rocketmail.com
Nothing to comment until the OP tells about his implementation...
But i'm sure mmap() is a single buffer operation just like file
operation...
Jan 2 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Skwerl | last post by:
Hi guys. I've written code to embed an ICC profile in a TIFF image, and I think my IO operations are slowing things down. It is taking about a second to embed each tag in 7-meg TIFF files. ...
5
by: Knackeback | last post by:
task: - read/parse CSV file code snippet: string key,line; typedef tokenizer<char_separator<char> > tokenizer; tokenizer tok(string(""), sep); while ( getline(f, line) ){ ++lineNo;...
0
by: Maxim | last post by:
I am wondering if anyone could suggest come performance improvements for processing a very large file. THe processing taking place here is on 30-50MB chunks of the file. Performance is...
1
by: jm | last post by:
Those of you who use Visual Studio, do you find a big performance difference between the single file model and the web form / class behind form model? I am trying to justify purchasing Visual...
3
by: Darrel | last post by:
I've been working on a fairly simple CMS for a fairly small site. Each page is a DB query to grab the content for the page. I also have some ancillary content that isn't specifically associated...
5
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated),...
26
by: Bill | last post by:
Every now and then when I go on my form in the IDE the form goes blank and the computer grinds away for 10 or 20 seconds and then everything reaapears. What exactly is the computer doing and is...
1
by: Dan R. | last post by:
I'm using the following to open and print values from a .dat file but I can't figure out how to sort the results. I think I need to use either the array_multisort() or krsort() functions. If so,...
6
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
The same error messages full out the application event log. --- "The open procedure for service "ASP.NET" in DLL "C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.dll" failed. Performance...
7
by: cesco | last post by:
Hi, I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? I've...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.