| | |
Fast Lookups for Mobile Number Prefixes.
![]() |
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 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.
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)
containsKey()
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.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
![]() |
Similar Threads
- how to add the mobile number in the employee information system in c language (C)
- how to get mobile number in jsp (JSP)
- Windows Visa Home Basic Major Problem (Windows Vista and Windows 7)
Other Threads in the Java Forum
- Previous Thread: Converting a string array into an int from a text file
- Next Thread: null pointer exception problem
| Thread Tools | Search this Thread |
6 @param actuate android api applet application arc array arrays automation balls binary bluetooth bold business byte c++ chat class client code codesnippet collections compare component coordinates database defaultmethod detection doctype dragging ebook eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework hql html ide ideas image ingres input integer internet intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans newbie nextline parameter php pong problem program programming project recursion recursive scanner sell server set sms sort sql string sun swing swt terminal threads tree web websites windows





