I am looking for a Open Source Java API that
- Has a Binary Search implementation that can be used in our custom applications for faster search through a pool of in-memory objects.(Anywhere between 1,000 to 50,000 objects)
- Does not store the objects physically into a database, everything is in-memory. (Found some implementation doing so, but they do not fit in the requirement. However, an API that can be configured to keep the objects in memory OR as a database will also do.)
Cheers,
Nitin
-
Binary Search Implementation (3 messages)
- Posted by: Nitin Dubey
- Posted on: July 05 2005 14:03 EDT
Threaded Messages (3)
- Binary Search Implementation by David Thielen on July 05 2005 15:02 EDT
- Thanks by Nitin Dubey on July 05 2005 16:13 EDT
- You could try... by Gary Bentley on July 06 2005 01:55 EDT
-
Binary Search Implementation[ Go to top ]
- Posted by: David Thielen
- Posted on: July 05 2005 15:02 EDT
- in response to Nitin Dubey
Just use Arrays.binarySearch - in the base java runtime.
thanks - dave -
Thanks[ Go to top ]
- Posted by: Nitin Dubey
- Posted on: July 05 2005 16:13 EDT
- in response to David Thielen
Thanks Dave M working on it.
Regards,
Nitin -
You could try...[ Go to top ]
- Posted by: Gary Bentley
- Posted on: July 06 2005 01:55 EDT
- in response to Nitin Dubey
JoSQL (http://josql.sourceforge.net), but it doesn't use binary searching... I tried using binary searching via Lists but it starts to slow everything down when you insert a new record into the index... i.e. resorting 50K records just grinds everything to a halt... JoSQL is useful in that it allows SQL statements to be applied to Lists of Java objects... I may implement indexes in JoSQL eventually... JoSQL is pretty quick though... It depends upon what your desired response time is...
For example on the following query:
SELECT *
FROM FileWrapper
WHERE name LIKE '%.html'
ORDER BY name
on 108K "FileWrapper" objects, the WHERE clause took:
~0.1s to execute
The ORDER BY part took:
~0.3s to execute for about 26K objects matched from the WHERE clause.
I executed the above query on my home machine running Liunx, 512MB ram, 2.4GHz processor...
You may be best off with a TreeMap... better insert performance, though can be slightly slower on searching...
G.