#343 [patch] Making type casting thread-safe

open
nobody
None
5
2013-07-25
2013-07-25
No

This reworks current implementation of casts as a linked list with entries that get promoted to the beginning of the list when they are matched at runtime. The rationale for this was apparently performance improvement for cases when there was a function accepting a reference to a base class with a large number of derived types of which only a subset that was actually used. This resulted in a significant speed up, however it also effectively precluded a model with multiple interpreters accessing swig-bound infrastructure from multiple threads.

For example, see

http://swig.10945.n7.nabble.com/Threading-Issues-td11581.html

It a nutshell, this patch replaces the linked list with a list of arrays that does not get modified at runtime. The content of the cast arrays is sorted during the initialization so that subsequent lookups can use binary search over the entries obtaining O(log n) performance.

1 Attachments

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks