H
H. S. Lahman
Responding to Timasmith...
It depends upon the context. If you only need the search as a response
to particular interactive user request, then that 10 ms will not be
noticeable compared to the hundreds of milliseconds for the user's
typing. (It will probably take longer just to read the data from disk.)
OTOH, if your software is in the bowels of an HMO's multi-user
application processing 1K pharmacy coverage requests a second, you
probably need to speed things up a tad. [Though I don't know why a
pharmacy would be providing partial keys; maybe they can't read the
doctor's writing. B-)] In fact, then you probably don't want to read the
DB at all for an individual request. You probably want to read the data
into memory at startup and answer the queries from memory. If the data
is only using 1.5 Mb, you could probably have another 5-10 Mb of
supporting data structures for the searches w/o getting into page
faulting trouble.
Bottom line: I think you need to look at the situation and determine
what is acceptable performance and then do any trade-offs from there.
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
(e-mail address removed)
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
(e-mail address removed) for your copy.
Pathfinder is hiring:
http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH
So I can point you to a file which is near exactly what I would be
searching.
http://www.fda.gov/cder/ndc/ziptext.zip
It is a list of medications. There are 50,000 which is a reasonable
representation. Look at column G in listings.txt. If you take that
it is 1.5MB in size.
If I load up the items into an ArrayList and then search linearly for
items matching WELLBUTRIN
then do to 1000 searches takes 9-11 seconds. So 100 searches a second
seems rather fast, maybe I am worrying about nothing.
It depends upon the context. If you only need the search as a response
to particular interactive user request, then that 10 ms will not be
noticeable compared to the hundreds of milliseconds for the user's
typing. (It will probably take longer just to read the data from disk.)
OTOH, if your software is in the bowels of an HMO's multi-user
application processing 1K pharmacy coverage requests a second, you
probably need to speed things up a tad. [Though I don't know why a
pharmacy would be providing partial keys; maybe they can't read the
doctor's writing. B-)] In fact, then you probably don't want to read the
DB at all for an individual request. You probably want to read the data
into memory at startup and answer the queries from memory. If the data
is only using 1.5 Mb, you could probably have another 5-10 Mb of
supporting data structures for the searches w/o getting into page
faulting trouble.
Bottom line: I think you need to look at the situation and determine
what is acceptable performance and then do any trade-offs from there.
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
(e-mail address removed)
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
(e-mail address removed) for your copy.
Pathfinder is hiring:
http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH