This project has moved and is read-only. For the latest updates, please go here.

Extreme map rendering slowdown

Topics: SharpMap Project, SharpMap v0.9 / v1.x
Feb 3, 2012 at 10:05 AM

I have a WInForms project that uses SharpMap.

It can use local maps and also tile-based maps form the internet, like openstreetmap and map quest, Iw has been working well so far.

Yesterday I refreshed the sharp map version and compiled via change set 95837. (I use the trunk)

After installing there is a big slowdown in map rendering on some machines. The previous version (checked at the end of november) worked great, but this version is simply unusable. E.g. it takes 20-30 seconds to render an 1024x768 map from openstreetmap, and also my sqlite based local maps slows down.

I know the proxy settings problems for web based maps, they ar set in a proper way, so the previous version was fast enough.

Do you know anything about the reasons? Is there any change that can cause this?

Thanks in advance and thank you for your work!

Feb 4, 2012 at 9:03 AM

Is there any similarity between the mashines that have the big slow-down (1 Core Processor, low amount of RAM, ...)?

Are you using web-based maps when you are see the big slowdown, or is it also there for only local data?

The most common problem with slow rendering and web-based maps is the "Automatically detect settings" in Internet Explorer beeing checked. I did a checkin of a brutile.dll that had a workaround for this earlier but when we moved to using brutile from NuGet i think this got replaced.

I've uploaded my brutile-version that contains the patch as an attachment to this release now:

Could you please verify if you still have the problems if you replace your brutile-dlls with those one?

And if the performace changes when checking / unchecking the "Automatically detect..." setting in IE.

Feb 8, 2012 at 8:00 PM
Edited Feb 8, 2012 at 8:01 PM

I had known this connection settings and brutal issues, so they were corrected, but the symptoms are the same.

The slowdown is still exists, also for local data. 

Configuration: Intel(R) Xeon(R) CPU E620 2.4 GHZ (4 processors) 4GB RAM; OPeration System: WIndows Server 2008 R2 64 bit. My application is running as x86 one.

There are 4 machines with the same config, the problem is the same. The problem is critical, makes my app unusable.

Thanks for  your help!

Feb 8, 2012 at 9:52 PM

And one more thing that may be related to this: when free memory is lower than 150-200 MB (even if available memory is more, than 2 GB! ) this slowdown is even more extreme. Than it is more than a minute to get a map...twice slower than the original slow behavior...

Feb 9, 2012 at 7:54 AM

What datasources do you use, a database? or Shapefiles? or raster?

Feb 9, 2012 at 8:30 AM

I'd suggest you compile the latest BruTile yourself and use that.

If that does not solve your problems, it would be really helpful if you'd profile your application (e.g. JetBrains' dotTrace) so we don't need to fish in murky waters.


Feb 13, 2012 at 11:48 AM
Edited Feb 13, 2012 at 11:50 AM

Compiling Brutile by myself helped a bit, but I found another factor after my investigation that can cause the slowdown, and is is related with the free memory of the Windows. When free memory is under 50-100 MB, than maps are slow (web based and also local data based ones), but if it is higher, maps are much more faster. I don't really understand, because the available memory is more than 1GB in every cases... Do you have any experiences with it?

Thanks you for your help and effort, and sorry to misleading by my earlier questions.

Feb 13, 2012 at 12:25 PM

What kind of cache do you use? Your problems may be related to the use of MemoryCache that, due to low memory needs to swap to disk.

Try to use/setup FileCacheProvider. I think petlof has made this real easy by simply passing a path to a folder to the TileLayer constructor (fileCacheDir).

Hth FObermaier

Feb 13, 2012 at 12:30 PM
Edited Feb 13, 2012 at 12:34 PM

I don't set anything related to cacheing. So the default would be MemoryCache?

I just add a web tile layer like this:

TileLayer tileLayer = new TileLayer(new GoogleTileSource(GoogleMapType.GoogleMap), GOOGLELAYERNAME);
tileLayer.SRID = 3857;

And my physical available memory is more, than 1GB and the physical free memory is less, than 100 when I get this slowdown.

Feb 13, 2012 at 12:38 PM


var tileLayer = new TileLayer(new GoogleTileSource(GoogleMapType.GoogleMap), GOOGLELAYERNAME, 
new Color(), true, Path.Combine(Path.GetTempPath(), "GoogleTileCache"))
Feb 13, 2012 at 12:46 PM
Edited Feb 13, 2012 at 12:49 PM

Thanks,I'll try it. And what about local datasouce based vector layers (shape, spatialite). They behave the same way as web based ones. Do they have also cache?

Feb 15, 2012 at 11:26 AM

I tried, it did not change anything, the problem is the same.

Feb 15, 2012 at 2:36 PM

Please profile your application with JetBrains' dotTrace. The evaluation period is free of charge and the results are really good.


Feb 16, 2012 at 12:28 PM

Here is the solution:

Thanks for all!

Feb 17, 2012 at 7:23 AM
tmatrai wrote:

Here is the solution:

Thanks for all!

Hi, tmatrai!

I have the same problem, but this patch didn't help me :(

Do you have any idea?

Feb 17, 2012 at 11:37 AM
Edited Feb 17, 2012 at 11:50 AM

Did you check your proxy and lag settings as described above? Do you have the later brutile.dll? Do you try to use file cache?

Feb 17, 2012 at 12:35 PM

I use file cashing, "Automatically detect settings" is unchecked, proxi server not using.

Using later version brutile.dll doesn't let to compille BruTile.MbTiles.csproj.

What is lag settings?

Feb 17, 2012 at 12:43 PM

Sorry, LAN settings, it was misspelling. And you should also play with proxy settings.

Feb 17, 2012 at 1:33 PM

Perhaps problem in using webdev.webserver40 instead of IIS?

Feb 17, 2012 at 3:08 PM

What kind of app do you have? Desktop or web? If desktop, then it does not matter as I think.

Feb 18, 2012 at 6:58 AM

Web application based on WMS web app sample from main trunk repository.

Feb 18, 2012 at 4:08 PM

Sorry nigr0nx I have experiences only about desktop SharpMap apps :(