473,614 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I/O ofa large number of files

Hi all:

I am processing a 3D bitmaps(essenti ally ~1024 2D bitmaps with a size of 1MB
each).

If I want read large amount of radom data from this series, how could I
buffer the file to get optimized performance? With WinXP pro/512MB memories
and no other big programmes running at the same time.

Cheers

David
Nov 15 '05 #1
5 1918


David wrote:
Hi all:

I am processing a 3D bitmaps(essenti ally ~1024 2D bitmaps with a size of 1MB
each).

If I want read large amount of radom data from this series, how could I
buffer the file to get optimized performance?
If the access pattern is "radom" there isn't much you
can do. Load as much as you can manage into memory and hope
your next "radom" access is for something already loaded; if
it isn't, throw something away and load the piece you're
trying to get at. The selection of what to pre-load, what
to throw away, and how much to load for an out-of-memory
experience depends on the access patterns. Some patterns
will lend themselves to exploitation, others won't.

The C pieces you'll need will probably be fopen (with
"rb" mode, most likely), fseek, fread, and fclose, along
with the usual memory-management stuff. I mention fclose
because your system may not permit you to have 1024 file
streams open simultaneously; you may need to "multiplex"
the large number of files across a smaller number of FILE*
streams by closing and re-opening as necessary. The
FOPEN_MAX macro in <stdio.h> gives an approximation to the
number of streams you can open simultaneously, but the
value should be treated only as an approximation.
With WinXP pro/512MB memories
and no other big programmes running at the same time.


Irrelevant detail. Well, highly relevant in some ways,
but not to your question (if there is one) about the C
programming language. Windows-oriented newsgroups may have
suggestions that go beyond what C itself can provide.

--
Er*********@sun .com

Nov 15 '05 #2
David wrote:
Hi all:

I am processing a 3D bitmaps(essenti ally ~1024 2D bitmaps with a size of 1MB
each).

If I want read large amount of radom data from this series, how could I
buffer the file to get optimized performance? With WinXP pro/512MB memories
and no other big programmes running at the same time.

Cheers

David

Map the whole file into memory (backed up by the OS).
Read the docs for MapViewOfFile API. This will not use
all the RAM of course, but the system will do the paging
for you, what is far more efficient than what you can do
yourself.

This is not a standard C function, and in another operating
systems you may have to use a different approach.

Using standard C functions you can do the same (as Eric
Sossman replied), but it will be less efficient and is not
trivial to develop.

A simpler approach using just fopen would be to allocate 1MB of virtual
memory with malloc(), then read the whole file into it. The system will
do the paging for you in that case. Frequently used pages will be kept
in memory, less frequently used will be eventually be paged out.

jacob
Nov 15 '05 #3
In article <dc**********@s corpius.csx.cam .ac.uk>,
David <xz***@noreply. com> wrote:

I am processing a 3D bitmaps(essenti ally ~1024 2D bitmaps with a size of 1MB
each).

If I want read large amount of radom data from this series, how could I
buffer the file to get optimized performance? With WinXP pro/512MB memories
and no other big programmes running at the same time.


I'll take a wild guess and say that whatever process is generating
these 3D bitmaps is pretty high-tech and not cheap...perhaps there is
room in the budget for another gig of RAM? Then you could load the
whole 3D image into RAM and still have the original 512 for the OS and
application. Next step would be to upgrade to a processor with large
amounts of cache.

Sure, it would be cool to optimize some graphics-intensive C code to
minimize thrashing but I hope you are being paid well enough that
1G RAM is cheaper than a couple days of your valuable time.
--
7842++
Nov 15 '05 #4
Thank you all for thsoe informatvie and inspiring replies!

Maybe for my purpose, I may opt to buffer a number of files and use a
counter to record the times of individual files being accessed. Once an
unbuffered file is required, it will replace the least accessed file.
I would prefer this easy and platform independent method... coz I know
little APIs...
:( ...

Hope the random statistics would do the jod themselves.

"David" <xz***@noreply. com> wrote in message
news:dc******** **@scorpius.csx .cam.ac.uk...
Hi all:

I am processing a 3D bitmaps(essenti ally ~1024 2D bitmaps with a size of
1MB each).

If I want read large amount of radom data from this series, how could I
buffer the file to get optimized performance? With WinXP pro/512MB
memories and no other big programmes running at the same time.

Cheers

David

Nov 15 '05 #5
In article <dc**********@s corpius.csx.cam .ac.uk>, David wrote:
Hi all:

I am processing a 3D bitmaps(essenti ally ~1024 2D bitmaps with a size of 1MB
each).

If I want read large amount of radom data from this series, how could I
buffer the file to get optimized performance? With WinXP pro/512MB memories
and no other big programmes running at the same time.


the answer is process specific - it depends what you're doing with the bitmap.

the easiest solution is probably to put more ram in your PC - if the OS can
handle it.

otherwise you may need to break the bitmap up into chunks which can be
processed independantly.
Bye.
Jasen
Nov 15 '05 #6

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

Similar topics

2
2088
by: Edvard Majakari | last post by:
Hi all ya unit-testing experts there :) Code I'm working on has to parse large and complex files and detect equally complex and large amount of errors before the contents of the file is fed to module interpreting it. First I created a unit-test class named TestLoad which loaded, say, 40 files of which about 10 are correct and other 30 files contained over 20 different types of errors. Different methods on the TestLoad class were coded so...
36
6358
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but something I'll need in this case is some experience-based set of rules about how to use python in this context. For example... is defining readonly attributes in classes worth the hassle ? Does duck-typing scale well in complex
14
1749
by: Jason Heyes | last post by:
I have read item 26 of "Exceptional C++" that explains a way of minimising compile-time dependencies and, therefore, a way to improve compile speeds. The procedure involves replacing #include directives with forward declarations from within header files. However, a potentially large number of source files may have previously relied on the removed #include directives being present. Therefore it is likely that a large number of source...
6
2647
by: Greg | last post by:
I am working on a project that will have about 500,000 records in an XML document. This document will need to be queried with XPath, and records will need to be updated. I was thinking about splitting up the XML into several XML documents (perhaps 50,000 per document) to be more efficient but this will make things a lot more complex because the searching needs to go accross all 500,000 records. Can anyone point me to some best practices...
20
4253
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black blob) ... all the pages were created in Notepad over the last
1
6311
by: Lars B | last post by:
Hey guys, I have written a C++ program that passes data from a file to an FPGA board and back again using software and DMA buffers. In my program I need to compare the size of a given file against a software buffer of size 3MB. This is needed so as to see which function to use to read from the file. As the files used range from very large (>30GB) to very small (<3MB), I have enabled large file support and I obtain the file size by using the...
8
6383
by: theCancerus | last post by:
Hi All, I am not sure if this is the right place to ask this question but i am very sure you may have faced this problem, i have already found some post related to this but not the answer i am looking for. My problem is that i have to upload images and store them. I am using filesystem for that. setup is something like this, their will be items/groups/user each can
1
3879
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
Using .NET 2.0 is it more efficient to copy files to a single folder versus spreading them across multiple folders. For instance if we have 100,000 files to be copied, Do we copy all of them to a single folder called 'All Files' Do we spread them out and copy them to multiple folders like Folder 000 - Copy files from 0 to 1000 Folder 001 - Copy files from 1000 to 2000 Folder 002 - Copy files from 2000 to 2999
1
4282
by: =?Utf-8?B?UmFkZW5rb19aZWM=?= | last post by:
I am using standard File.Copy(source,dest,true) method in C# and I have problem with copying large number of files. Here is my code: foreach (FileInfo file in files) { File.Copy(file.FullName,destPath+ "\\" + file.Name, true); } This code copies only 5 or 10 files but in "files" collection there is 60 files.
36
2533
by: sh.vipin | last post by:
how to make large macro paste the code as it is Problem Explanation '-- For example in the program below /* a.c - starts here */ #define DECL_VARS() \ unsigned int a0;\ unsigned int a1;\ unsigned int a2;\
0
8179
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8124
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8576
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8427
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6087
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5538
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1712
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1421
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.