Community of VE/MapPoint Users and Developers
This is a discussion on Mappoint eats up my cpu bit by bit. within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello dear programmers, I'm developing an application with Mappoint using VC++. What I'm doing is getting a position from the ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| I'm developing an application with Mappoint using VC++. What I'm doing is getting a position from the GPS and put a smalle circle on the map. For testing I use a "static" GPS (in our office) that doesn't move, we just use it for testing. It all works well the GPS sends every second a new position (wich is finally the same position). But the problem is it seems that every position I get, mappoint needs more processingtime. So after a few minutes, mappoint has to process about 300 pushpins, and than the processorfan really has to cool the cpu, because Mappoint sucks almost all of the cpu. What I did is making a new pushpin everytime I get a new position. And if I want to follow a vehicle on the map with its trace (these are the old pushpins on the map) than Windows will crash after 5 minutes. So how can I solve this situation? Again, I use this everytime I get a new position: m_Loc = m_Map.GetLocation(Lat, Lon, 1); m_Pin = m_Map.AddPushpin(m_Loc.GetLocation(), Txt); m_Pin.SetSymbol(21); m_Loc.GoTo(); I hope somebody can help me, so thank you very much |
| |||
| Re: Mappoint eats up my cpu bit by bit.
Hi, 300 pushpin is not so mutch because the map does not to handle all 300, only 1 comes new every second. Maybe the problem is because you have honderds pushpins on same location with the test ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Mappoint eats up my cpu bit by bit.
Thank you for your reaction Wilfried, I don't think it has to do with the same position on the map. An the reason I think so is, I have another project wich I use it for experimenting things with mappoint. And the funny thing is, that I don't have that problem, though I have 500 pushpins, the cpu load remains the same. Only the RAM increases a little bit (you can see a very small change). So I've to figure out what's the cause of increasing the cpu-load. It's a little bit difficult to find out, because I used cut&paste, so I don't see differences in code.... I hope someone can give a tip/tric to solve this. If I find the cause, I'll report it to you immediatly. |
| |||
| Re: Mappoint eats up my cpu bit by bit.
Hello programers, I found out what the evil bug is (actually it's more a bad coding of mine If you look at the code below: void SomeFunction() { m_Loc = m_Map.GetLocation(dLat, dLon, 1); m_Pin = m_Map.AddPushpin(m_Loc.GetLocation(), Txt); m_Loc.GoTo(); } Everytime I get a new latitude. longitude, I call this function to draw on the map. But by a wrong coding, Txt has the same string. Than something goes wrong, I don't really understand what's going on in Mappoint. But somehow if I add a pushpin on the same location with the same NAME (that's Txt stands for) than uses more processingtime. Can somebody explain me why that is? Because I didn't really dive in the mappoint API, I just looked for the needed functions to call, to make my application work. I hop somebody can tell me why Mappoint behaves like that. |
| |||
| Re: Mappoint eats up my cpu bit by bit.
Do i understand you right? You add pushpins with AddPushpin(aLocation, aName) and this adding gets slower for every pushpin you add? If this is the case, I encountered the same problem during performance tests and found an easy but strange solution: don't use AddPushpin(aLocation, aName); try this one: pin = AddPushpin(aLocation, ""); pin->Name = aName; don't ask my why this is faster, but it's really much faster, the more pushpins you already have the greater the speedup is. Example: Adding 256 pushpins to a map with an empty string as name took 4.185 seconds Adding 256 pushpins to a map with "moo" als name took 39.841 seconds Adding 256 pushpins to a map with an empty string as name followed by pin->Name = "moo" took 6.177 seconds It's even worse with 1024 pins: No name: 13.269 seconds "moo" as name: 38 minutes and 32.676 seconds! No name followed by pin->name = "moo": 23.352 seconds by the way, the length of the name makes only a small difference, if it's 1 character long or 50 doesn't really matter. edit: and using different names for each pushpin doesn't matter too if i remember right (and my pushpins had 1° distance between each other) |
| |||
| Re: Mappoint eats up my cpu bit by bit.
Hi, Thanks for feedback. Ok so that is the reason I did never encountered this problem because in each application all pushpins have exclusive name. Probably it has something to do with database management. I assume there is an internal index on the pushpin's name, so a internal search to it bounces on the same over and over again. Probably it increment the internal index until EOF or name change. I can not come to a better explanation / reason... But the nice thing is that problem is found
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| bit, cpu, eats, mappoint |
| ||||
| Posted By | For | Type | Date | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 11-30-2006 05:24 AM | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 11-30-2006 04:30 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |