943,561 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 704
  • Java RSS
Jun 23rd, 2009
0

Fast Lookups for Mobile Number Prefixes.

Expand Post »
The environment of my application is as mentioned below :

The application is a Router/Accounter library used to identify an appropriate Route (and also the price for that) when a destination for a Mobile number is queried through the API. The Route to be used for sending an SMS message depends on two things the, one the destination prefix and the two the user/client sending the SMS message.

To explain the environment in more detail, lets say an External application queries my library with details of a mobile number say 919833XXXXXX, and user say smssender. Now the route to be used for sending this message will be identified by checking if the user is have a mapping for any of the prefixes in the destination say 91 or 919833. This is where my problem lies. Given a destination I want to find out all the prefixes for the destination and then check if the user has a mapping for any of these. I am currently using a HashMap to store the Prefixes (from the Prefix master) as Keys and their details as the Values. So to find a prefix I simply run a
java Syntax (Toggle Plain Text)
  1. containsKey()
method with a substring of the destination which gives me the prefix.

I want to know whether is there any faster more optimized way to do this search, maybe some data structure which is more suitable to such lookups than the HashMap or anything else that would possibly optimize my looking up further.

Currently the typical times for the lookups are ~30msecs for 10K lookups.

This application is written in Core Java and mostly called by a plugin Servlet.

Note : I have already considered the possibility of using a Constant Database such as the CDB with the SG-CDB interface for Java, but since this uses hash tables internally, which I am already using through the use of a HashMap, I guess it won't be much of performance booster, if it would be pls note so how.

Thanks for your help already.
Similar Threads
Reputation Points: 485
Solved Threads: 89
Posting Shark
verruckt24 is offline Offline
944 posts
since Nov 2008
Jun 23rd, 2009
0

Re: Fast Lookups for Mobile Number Prefixes.

i'm not sure but maybe it will be faster if you write a C function that does this job and use it via JINI..
just a suggestion.
Reputation Points: 16
Solved Threads: 0
Light Poster
xyzt is offline Offline
35 posts
since Apr 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Converting a string array into an int from a text file
Next Thread in Java Forum Timeline: null pointer exception problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC