Enhanced TinyMap

04/19/2015 07:11 U2_Caparzo#1
Well, this a quite basic edit i did to the [Only registered and activated users can see links. Click Here To Register...] released by .Kinshi to extract, convert and load the maps using multi-threading, all it does is spawn one thread per processor, create a queue with the elements that must be processed (names of files for example), and then start the threads that will keep trying to get an element from the queue until it's empty.
On my pc (quad-core), this lets the TinyMap load in ~30-40% of the time taken by the original dll.

Convert
TinyMap: 29.8 secs
Enhanced: 12.4 secs

Load
TinyMap: 4.8 secs
Enhanced: 1.4 secs

png converter
TinyMap: 115.2 secs
Enhanced: 43.9 secs

Note: I did not test the new dll, i just assumed it works based on the time loading, there is no map missing during the convertion and that the .png images were generated correctly
04/19/2015 11:02 Best Coder 2014#2
Nice work, but why not just use [Only registered and activated users can see links. Click Here To Register...]?
04/20/2015 02:24 U2_Caparzo#3
Quote:
Originally Posted by Best Coder 2014 View Post
Nice work, but why not just use [Only registered and activated users can see links. Click Here To Register...]?
Honestly, because of a bad test i did some months ago, i used to think that the Parallel class may be quite slow, just noticed i was totally wrong :o, so it's probably that i would have used the Task.Parallel class then.

Did a quick test using Parallel.ForEach.

Convert to tmap: 18.5 secs
Load tmaps: 1.8 secs load
Generate png images: 44.8

Also, noticed that some maps are using the same DMap file, this may throw an exception because of multiple threads are accessing to the same file when converting the DMaps (i ignored these maps for this test), that is why i added the queue, i know that FileStreams can support this, but will be a bit slower (again, based on an old test i did), and would have to find a way to do this using the Task.Parallel class.
Probably i will add an option to save the maps by name instead of Id, so no repeated maps with different Id would be stored, then i surely will use the Task.Parallel class, and possibly support to convert only missing dmap files instead of deleting the folder and convert all the dmaps again.
06/02/2015 14:46 abdulrahmanok#4
how to use it ?