473,408 Members | 2,813 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,408 software developers and data experts.

mmap() in C/C++ vs. Java


Hi there,

I was wondering if anyone had experience with File I/O in Java vs. C/C+
+ using mmap(),
and knew if the performance was better in one that the other, or more
or less negligible.
My instinct would say C/C++ is faster, but Java has made some
improvements with its
FileChannel class.

The situation is that a 1GB is to be loaded into memory and indexed as
the user needed.

thanks!
brigit.

Feb 27 '07 #1
2 2759
On Feb 27, 8:18 am, beejisbri...@gmail.com wrote:
Hi there,

I was wondering if anyone had experience with File I/O in Java vs. C/C+
+ using mmap(),
and knew if the performance was better in one that the other, or more
or less negligible.
My instinct would say C/C++ is faster, but Java has made some
improvements with its
FileChannel class.

The situation is that a 1GB is to be loaded into memory and indexed as
the user needed.
Memory mapping is OS specific.
Any support for memory mapping is a compiler extension and not
directly supported by the C language per se.
Probably, you want news:comp.unix.programmer.
Of course, you'll read their FAQ first:
http://www.erlenstar.demon.co.uk/unix/

Feb 27 '07 #2
be**********@gmail.com wrote:
Hi there,

I was wondering if anyone had experience with File I/O in Java vs. C/C+
+ using mmap(),
and knew if the performance was better in one that the other, or more
or less negligible.
My instinct would say C/C++ is faster, but Java has made some
improvements with its
FileChannel class.

The situation is that a 1GB is to be loaded into memory and indexed as
the user needed.

thanks!
brigit.
There's no such language called 'C/C++'. The C and C++ languages
differ in subtle but important ways. Though they have a shared
history, they're better thought of as similar but distinct languages
rather than as "C/C++."

Now coming to your question, though I don't know about Java, but C and
C++ don't provide any native support for memory-mapped I/O. It's more
a facility of the underlying operating system and it's relative
performance is probably dependant on a lot of disparate factors, over
which the languages themselves are likely to have little, if any,
control.

Feb 28 '07 #3

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

Similar topics

4
by: Hao Xu | last post by:
Hi everyone! I found that if you want to write to the memory got by mmap(), you have to get the file descriptor for mmap() in O_RDWR mode. If you got the file descriptor in O_WRONLY mode, then...
4
by: Fabiano Sidler | last post by:
Hi folks! I created an mmap object like so: --- snip --- from mmap import mmap,MAP_ANONYMOUS,MAP_PRIVATE fl = file('/dev/zero','rw') mm = mmap(fl.fileno(), 1, MAP_PRIVATE|MAP_ANONYMOUS) ---...
2
by: beejisbrigit | last post by:
Hi there, I was wondering if anyone had experience with File I/O in Java vs. C++ using mmap(), and knew if the performance was better in one that the other, or more or less negligible. My...
1
by: James T. Dennis | last post by:
I've been thinking about the Python mmap module quite a bit during the last couple of days. Sadly most of it has just been thinking ... and reading pages from Google searches ... and very little...
1
by: koara | last post by:
Hello all, i am using the mmap module (python2.4) to access contents of a file. My question regards the relative performance of mmap.seek() vs mmap.tell(). I have a generator that returns...
2
by: Neal Becker | last post by:
On linux, I don't understand why: f = open ('/dev/eos', 'rw') m = mmap.mmap(f.fileno(), 1000000, prot=mmap.PROT_READ|mmap.PROT_WRITE, flags=mmap.MAP_SHARED) gives 'permission denied', but...
0
by: Kris Kennaway | last post by:
If I do the following: def mmap_search(f, string): fh = file(f) mm = mmap.mmap(fh.fileno(), 0, mmap.MAP_SHARED, mmap.PROT_READ) return mm.find(string) def mmap_is_in(f, string): fh =...
0
by: Gabriel Genellina | last post by:
En Thu, 29 May 2008 19:17:05 -0300, Kris Kennaway <kris@FreeBSD.org> escribió: Looks like you should define the sq_contains member in mmap_as_sequence, and the type should have the...
1
by: magnus.lycka | last post by:
Does anyone recognize this little Python crasher? I'll file a bug report unless someone notices it as an already documented bug. I found some open mmap bugs, but it wasn't obvious to me that...
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?
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
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
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...
0
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...
0
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,...
0
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...

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.