473,804 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fastest method to load text file

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
Nov 21 '05 #1
5 2843
Gaurav,
what is the fastest method to sort and load


It is not possible to sort a standard textfile at least there has to be
something what can be the sortkey.

Cor
Nov 21 '05 #2
the listbox does sort the strings while inserting if sort is set to true

"Cor Ligthert" wrote:
Gaurav,
what is the fastest method to sort and load


It is not possible to sort a standard textfile at least there has to be
something what can be the sortkey.

Cor

Nov 21 '05 #3
the listbox does sort the strings while inserting if sort is set to true

"Cor Ligthert" wrote:
Gaurav,
what is the fastest method to sort and load


It is not possible to sort a standard textfile at least there has to be
something what can be the sortkey.

Cor

Nov 21 '05 #4
"Cor Ligthert" <no************ @planet.nl> schrieb:
what is the fastest method to sort and load


It is not possible to sort a standard textfile at least there has to be
something what can be the sortkey.


Huh?

You can sort the lines alphabetically:

\\\
Dim sr As New StreamReader("C :\WINDOWS\win.i ni")
Dim Lines() As String = Split(sr.ReadTo End, ControlChars.Ne wLine)
sr.Close()
Array.Sort(Line s)
For Each Line As String In Lines
Debug.WriteLine (Line)
Next Line
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #5
Herfried,

I tried your code with a little change, what is the sense of this result.

///
\\\
Array.Sort(Line s)
Dim Lines() As String = Split(sr.ReadTo End, ControlChars.Ne wLine)
Dim sr As New StreamReader("C :\Test\Herfried s.txt")
For Each Line As String In Lines
M V P <URL:http://dotnet.mvps.org/>
Next Line
sr.Close()
You can sort the lines alphabetically:

Please, read my message again

Cor
Nov 21 '05 #6

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

Similar topics

0
1510
by: chad kline | last post by:
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
11
2119
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 like to be able to retrieve the name by searching for a given phone number the fastest I can. I have considered the posibility of using XmlTextReader with something like: <list> <item number="1234567"> <name>John Doe</name>
60
49223
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't be indexed/sorted. I don't want to load the entire file into physical memory, memory-mapped files are ok (and preferred). Speed/performance is a requirement -- the target is to locate the string in 10 seconds or less for a 100 MB file. The...
7
14150
by: Doru Roman | last post by:
Hi, What is the fastest way to evaluate manually the result in this case: int a, b, c; a = 255; b = 122; c = a & b; The only way I know is transforming each number into the binary value and
3
8196
by: _DD | last post by:
I had one experimented with binary serialization of an ArrayList of structs (each struct mostly contains strings). Strangely enough, it did not run as fast as custom XML storage (latter was nothing fancy, but did not use normal serialization). I was not pressed to get runtime optimized at the time, so I just went with XML. The situation has shifted, and I have to figure out the *fastest possible* way to save and reload that ArrayList. ...
5
2182
by: beersa | last post by:
Hi All, I have to query the database with the string from text file. Here are the details: OS: WinXP Home Pro DB: Oracle 9.x The table in DB has 20,000 rows. The text file has 15,000 rows. I wrote a program and read the string from text file and run SELECT query in DB
1
1058
by: Abrahams, Max | last post by:
I've looked into pickle, dump, load, save, readlines(), etc. Which is the best method? Fastest? My lists tend to be around a thousand to a million items. Binary and text files are both okay, text would be preferred in general unless there's a significant speed boost from something binary. thanks
0
9594
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
10599
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10347
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
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
9173
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
7635
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
6863
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();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.