473,386 Members | 1,796 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,386 software developers and data experts.

fastest way to load NON-readonly files.

i have searched around for an answer to this question,
but haven't found a satisfactory answer.

i understand things like mmap(2) can be used to quickly load
a file - but it seems to be a function for "read-only" situtations.
it doesn't appear to be useful in situations where editing must be
done on the loaded file.

the next fastest method (based on my searches) seemed to be
a fread(3)/read(2) loop. however, malloc(3)'s seems to slow
this down to an incredible extent.

--

the best way i could think to load a file for editing was
to load a file into a pointer to line pointers (each line
malloc'd for). however, on files with 10's and 100's of
thousands of lines, this process takes FOREVER. i am
reading line 150,000 half an hour later on a 500MHz
FBSD machine. there's actually 3 malloc() calls per line.
1 to increase the allocation to a pointer to line lengths,
1 to increase the allocation to pointers to lines,
and 1 to allocate space for the actual line.

i know there's a better way - but what is it?
my 'joe editor' can load a 20MB file in 1-2 seconds.
i can't figure out how to do it in under an hour! heh.
(unfortunately, "joe" code is undreadable!).

thank you.
Nov 13 '05 #1
0 1475

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

Similar topics

9
by: Rune Strand | last post by:
Hi, If I have a lot of integers and want do something with each digit as integer, what is the fastest way to get there? Eg. Make 12345 into an iterable object, like or "12345" (Btw: What is...
4
by: laurenq uantrell | last post by:
I am trying to determine which of three stored procedure designs are fastest in the Query Analyzer: One query is a straight SELECT query with all desired rows and a dozen (tblName.RowName =...
11
by: Ignacio X. Domínguez | last post by:
Hi. I'm developing a desktop application that needs to store some data in a local file. Let's say for example that I want to have an address book with names and phone numbers in a file. I would...
5
by: Gaurav - http://www.gauravcreations.com | last post by:
what is the fastest method to sort and load 1 lakh + strings in a list box from a text file. each string is in a new line -- Gaurav Creations
3
by: Sehboo | last post by:
I have to call a stored procedure which returns about 1000 rows with about 5 fields (most of them are int). What is the fastest way to load this data? if I just do DataTable.Load, then is it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.