473,695 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

At last something interesing to discuss: What is the fastest way to search a client-side database?

What is the fastest way to search a client-side database?

I have about 60-65 kb of data downloaded to the client which is
present in 3 dynamically created list boxes. The boxes are filled from
3 string arrays, which are just lists of people or companies in
alphabetic order. These names may have accented and umlauted
characters (which are present as the plain ASCII - not as the entity
&# character). The page is UTF-8 encoded.

e.g. strManager = "Adele Brown|Albert Meinstein|Alici a Perkins ..."

The first defect of the search is that it won't look for items
beginning with an umlaut etc.

The second defect is that it's far too slow.

The current page uses a regular expression search on the whole string
(it was taken from the O'Reilly regular expression book. Entering, for
instance, a 'b' in the search box results in the corresponding list
box showing ONLY those items beginning with a 'b' or 'B'. Likewise
entering 'Ba' narrows the search down even further. Unfortunately the
first letter search takes too much time.

What data structure is best used for holding the data for this search?
Should I construct a binary-search-tree on the server using the ids of
the actual data items (with left and right pointers) - created using
an associative array? With such a structure would a binary search
algorithm give me the fastest search?

PS: in the server database all these names have ids (but the previous
developer didn't download them to the client (to "save space").
Oct 29 '06 #1
3 1784
On Sun, 29 Oct 2006 21:41:55 GMT, Harry Haller <Ha***@Steppenw olf.com>
wrote:
>What is the fastest way to search a client-side database?
Please ignore this post - the following post supersedes it.
Oct 30 '06 #2

Harry Haller написав:
The current page uses a regular expression search on the whole string
(it was taken from the O'Reilly regular expression book. Entering, for
instance, a 'b' in the search box results in the corresponding list
box showing ONLY those items beginning with a 'b' or 'B'. Likewise
entering 'Ba' narrows the search down even further. Unfortunately the
first letter search takes too much time.
I can't offer your problem solution, but I suppose you are wrong in the
problem statement.
Regular expression search is fast enough independently of "one letter"
or "two letters" search is it.
Filling the listbox with new items is much more time consuming task and
the more values your search returns the more
continuous filling will be.
That is why guess your problem not search but filling speed.

Oct 30 '06 #3
On 30 Oct 2006 01:25:51 -0800, "marss" <ma***@ukr.netw rote:
>
Harry Haller ???????:
>The current page uses a regular expression search on the whole string
(it was taken from the O'Reilly regular expression book. Entering, for
instance, a 'b' in the search box results in the corresponding list
box showing ONLY those items beginning with a 'b' or 'B'. Likewise
entering 'Ba' narrows the search down even further. Unfortunately the
first letter search takes too much time.

I can't offer your problem solution, but I suppose you are wrong in the
problem statement.
Regular expression search is fast enough independently of "one letter"
or "two letters" search is it.
Filling the listbox with new items is much more time consuming task and
the more values your search returns the more
continuous filling will be.
That is why guess your problem not search but filling speed.
I noticed this too. It's about 50:50 at the moment - taking about 2-3
seconds, on average, for the longest list.

The first search is on a string about 47kb long containing about 1000
pipe (|) delimited phrases. E.g. a search on "n" loads the options
list with all phrases beginning with N or n (but not those with an
accented n). The second search is must less time consuming because it
searches on the second letter of all phrases beginning with n/N.

Should these 3 linear lists should be in 3 hash tables (javascript
"associativ e arrays"). In every case the value of the Options list
will be an integer corresponding to the ID of that SQL database entry.
The text will be the phrase.

It then looks like a pretty simple problem. The binary search is not
problem as the associative arrays will be ordered alphabetically. This
solution will also deal with the accented characters which are
currently being ignored by the search.

I should really post this page up on the internet, but before I do
that I should attempt the solution I outlined. I've been putting it
off because I'm busy doing other things and it's isn't a critical
issue - in that the current solution 'works'.

PS: the page uses UTF-8 encoding and all accented characters seem to
be in the extended ASCII set: 128-255 (I haven't noticed any accented
characters outside that range)
Apr 6 '07 #4

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

Similar topics

11
2540
by: Simon | last post by:
Hi, If I have a string, (variable len), and I am looking for the first position of one char in array starting from position 'x' For example, // the 'haystack' $string = "PHP is great, php is ok"; // the needles
6
5489
by: Jonathan | last post by:
I am hoping that someone more experienced than myself can point me towards what might be the fastest data lookup method to use for storing ip addresses. My situation is that I will need to maintain a list of perhaps 50 ip addresses to be used in a packet sniffing application. For each packet that goes through the application (which will be monitoring all traffic through a switch), I need to see if an entry for the source ip of that packet...
4
3558
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 = @param or @param = Null) filters in the WHERE statement. One query populates a #Temp table with the UniqueIDs from the results of the SELECT query in the above example, then joins that #Temp table to get the desired rows.
60
49096
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...
2
16406
by: UJ | last post by:
I have a dataset that will have say 10000 records in it with the names of files that are used by the system. I then have a large directory of files that correspond to that list of files and want to find any files that are in the directory but not referenced anymore (trying to do cleanup.) I know how to do all of the stuff but am looking for opinions/suggestions on the searching of the table. If you have say 10000 records, what's the fastest...
16
2578
by: mailforpr | last post by:
How do I do that? The thing is, the only information I have about the iterator is the iterator itself. No container it is belonging to or anything. Like template<Iteratorvoid totally_isolated(Iterator& it) { //how do I find out if it points to the end node? }
8
10286
by: sherifffruitfly | last post by:
Hi, I've been searching as best I can for this - coming up with little. I have a file that is full of lines fitting this pattern: (?<year>\d{4}),(?<amount>\d{6,7}) I'm likely to get a bunch of hits with this - I'm only interested in the *last* one. Is there a way to build the concept "last" into the
11
2419
by: Bob Rock | last post by:
Hello, I have an array of strings and need to find the matching one with the fastest possible code. I decided to order the array and then write a binary search algo. What I came up with is the following. I noticed that if I set: int upper = strings.GetUpperBound(0); I never match the last element in the array (i.e. "iii")
0
993
by: kishjeff | last post by:
Hi. This is a slightly convoluted question, but maybe it is obvious.. <convolutedquestion> I'd like to search a set of xml documents and get the element name and its id attribute of everything that does not have a <dlgancestor. The hard part for me is I want to skip all documents if they have <clientelements with less than two <majortabdescendent elements.
0
2318
by: dantz | last post by:
After reading all of the materials in msdn about interprocess communication now I am confused. I hope someone can give me some enlightment. I am developing a multithreaded client-server application which communicates via HTTP Request using HTTPListener/HTTPWebRequest. The server(which is the focus of my question) will be having different modules. I want these modules to communicate with each other using the fastest IPC but I can't figure...
0
8642
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9126
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...
0
9002
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...
1
8861
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
7673
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 projectplanning, coding, testing, and deploymentwithout 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...
0
4349
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3021
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
2
2283
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.