User Tools

Site Tools


Map Suite Geocoder Performance Guide

Welcome to Map Suite Geocoder performance test and promotion guide, we strongly recommend you read the presentation of Map Suite Geocoder to know what is it and how is it work before reading this guide. If you have already understood Map Suite Geocoder, let's go on with this guide.

The purpose of this guide is to help you to know following things:

  • An introduction for best practice of Map Suite Geocoder.
  • Using multi-thread to improve the performance of batch query.
  • The bottleneck of Map Suite Geocoder performance.

Best Practice

This section will introduce the best practice of Map Suite Geocoder.

Data Source

The Geocoder uses a native source data with an optimized set of United States street based on the TIGER® data from the U.S. Census Bureau. Below Figure 1 shows a partial source data files.

Figure 1. Source Data Files.

The latest data from 2018 is available with purchase, you can refer our Blog to know the detail.

Open & Close Geocoder

After instantiating a UsaGeocoder in your code, you have to call Open function before doing any match queries, and it's recommended to call Close function after finishing your query. The code looks like:

UsaGeocoder usaGeocoder = new UsaGeocoder(sourceDataPath, MatchMode.Default, StreetNumberMatchingMode.Default);
// custom code for match queries

When opening a Geocoder, some source data you specified would be preprocessed and loaded into memory, most of them are index data that would be read frequently in match query. These data would be released from memory after closing Geocoder.

You may see the MatchMode and StreetNumberMatchingMode parameters when initializing the UsaGeocoder, they can be used to specify different match policies. It's important that the more strict policy, the less match query time, and vice versa. All code snippets in this guide use Default MatchMode with ExactMatch and Default StreetNumberMatchingMode with ExactMatch.

Match Query

The Geocoder supports three overloaded Match functions to do the match query, see below code snippet:

usaGeocoder.Match(sourceText: "12448 Angelo Dr. Frisco TX 75035-6470");
usaGeocoder.Match(streetAddress: "12448 Angelo Dr. Frisco TX", zip: "75035-6470");
usaGeocoder.Match(streetAddress: "12448 Angelo Dr.", city: "Frisco", state: "TX");
  • The 1st call with only one sourceText parameter would spend relative most time, because Geocoder would consider both geocoding and reverse geocoding when parsing the sourceText, it's not recommended to use this call when you only want to do geocoding.
  • The 2nd call with streetAddress and zip parameters is relative fastest, only geocoding would be considered and the match results would be returned directly.
  • The 3rd call with streetAddress, city and state parameters is slower than 2nd call, the different of this call is that the results would be handled to filter city and state before returning.

To test the ultimate performance of Geocoder, we use the 2nd call in this guide.


In this section we will help you to use multi-thread to improve the geocoding when doing huge queries, then show you the benchmark results that we did.

Using Multi-thread

With the limitation of cache and file data read, Geocoder doesn't support inner multi-thread to do the batch query. But it's bad if customer wants to do a huge query with more than 100,000 input texts, below code snippet will help you to improve the query performance:

// convert original custom data to address-zip map list
string[] records = File.ReadAllLines(args[1]);
var addressZips = new List<List<string>>();
foreach (var item in records)
    var values = item.Split(',');
    string addressName = values[5];
    string zip = values[8];
    addressZips.Add(new List<string>() { addressName, zip });
// split address-zip map list to task chunks
int taskCount = 8;
int recordCount = addressZips.Count;
var taskAddressZips = new List<List<List<string>>>();
for (int i = 0; i < taskCount; i++)
    taskAddressZips.Add(new List<List<string>>());
int itemCount = 0;
int taskItemCount = 0;
while (itemCount < recordCount)
    if (taskAddressZips[taskItemCount].Count <= recordCount / taskCount + 1)
        taskItemCount += 1;
    itemCount += 1;
// generate tasks to geocoding
var tasks = new List<Task>();
for (int i = 0; i < taskCount; i++)
    var task = new Task((innerOjb) =>
        UsaGeocoder usaGeocoder = new UsaGeocoder(args[0]);
        var innerAddressZips = innerOjb as List<List<string>>;
        for (int j = 0; j < innerAddressZips.Count; j++)
            var results = usaGeocoder.Match(innerAddressZips[j][0], innerAddressZips[j][1]);
    }, taskAddressZips[i]);
// run all tasks
foreach (var task in tasks)

We preprocess the input texts to split them to eight chunks, then generate eight tasks to do the batch queries, each task maintains independent Geocoder to avoid multi-thread error.

Benchmark Reports

To compare the performance between single thread and multi-thread, we used the following (Figure 2) machine hardware device to do the benchmark:

Figure 2. Machine Hardware Device Information.

Below Figure 3 shows the benchmark result:

Figure 3. Single Thread & Multi-Thread Benchmark Result.

It shows that we improved about three times speed after using multi-thread. And the below Figure 4 shows the hardware usage when using multi-thread:

Figure 4. Hardware Usage Using Multi-Thread.

To dig the limitation of the Geocoder with multi-thread we also created different Amazon® instances to do the same benchmark. Below Figure 5 is the test result:

Figure 5. Amazon® Instance Benchmark Result.

The match query speed increased significantly after using high performance hardware device. Note that we set the thread count to eight because we always tend to make the thread count to equal with or less than the CPU core count, if you start too much threads, the query speed would decrease instead.

Bottleneck of Performance

In this section we will discuss what is the bottleneck of Map Suite Geocoder performance.


The most time spent of Geocoder is on I/O. Due to the size of source data is about 9.06 GB, Geocoder cannot load all of them into memory when opening, if we do that, it will spend a lot of time to open Geocoder. We already had optimized and made the Geocoder to load necessary source data when opening, and added in memory cache to increase the data read speed, it still would read data from files when doing match query, the I/O is the one of a bottleneck of performance.

Normalize Text

The another bottleneck is input/output text normalization, customer wants to input various of texts to do the match query, Geocoder has to split and explain them at first, then compare the normalized text cluster with cache or file data to do the match. The matched results also need to be normalized as the Geocoder result. We always keep to update our normalization algorithm to make it more faster and accurate.

Performance Test

Below Figure 6 is the analysis result that did 1,000 queries one by one, the execution time is 4.669 seconds:

Figure 6. Analysis Result With 1,000 Queries.

And the below Figure 7 is the analysis result that did 10,000 queries one by one, the execution time is 16.588 seconds:

Figure 7. Analysis Test With 10,000 Queries.

It's obvious that the most time spent is on I/O (includes file or cache data read), then normalization.

map_suite_geocoder_performance_guide.txt · Last modified: 2019/03/21 02:49 by tgwikiupdate