bzaar / DawgSharp

DAWG String Dictionary in C#
http://www.nuget.org/packages/DawgSharp/
GNU General Public License v3.0
118 stars 18 forks source link

Make DawgBuilder.Insert thread-safe #1

Closed bzaar closed 9 years ago

bzaar commented 10 years ago

... and verify that this actually speeds up things on a typical 4-core system. Excessive locking might negate all the benefits of parallelism. Try locking at Node and DawgBuilder levels and see what difference it makes.

bzaar commented 9 years ago

I have actually tried out the above suggestions and couldn't make it run any faster. Locking at the Node level is immensely slow because it has to create millions of ReaderWriterLock's and those are really expensive. Locking the whole tree doesn't do much good either: the process essentially becomes single threaded and the locking is just making it slower.