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

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|Alicia 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 1764
On Sun, 29 Oct 2006 21:41:55 GMT, Harry Haller <Ha***@Steppenwolf.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.netwrote:
>
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
"associative 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
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,...
6
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...
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 =...
60
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...
2
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...
16
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...
8
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...
11
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...
0
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...
0
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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
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,...

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.