472,782 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 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 1720
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.