Uh oh!
There was an error while loading. Please reload this page.
[generator] Remove global state around code generation - #444
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jonpryor
commented
Jul 5, 2019
Overall, I don't think that this is a good idea/is (currently) doomed to fail, for one reason:
For all binding projects except So long as See also:
I can imagine only two ways to make this work in principal:
One idea tossed around for (2) was to have each thread separately load every assembly, e.g. instead of loading (1) is probably too much work, and (2) is only an idea, with no confirmation that it could work. |
jpobst
commented
Jul 5, 2019
Fair enough, I think I can make it thread-safe with some other cleanup I want to do. I want to have a I will look further into that. |
jpobst
commented
Jul 8, 2019
For this PR, I would like to keep all the work around removing shared state, and I have reverted the bit about generating types in parallel. We can possibly revisit that in a future PR. |
| using (var sw = gen_info.OpenStream (opt.GetFileName ("Java.Interop.__TypeRegistrations"))) { | ||
| Dictionary<string, List<KeyValuePair<string, string>>> mapping = new Dictionary<string, List<KeyValuePair<string, string>>>(); | ||
| foreach (KeyValuePair<string, string> reg in gen_info.TypeRegistrations.OrderBy (p => p.Key, StringComparer.OrdinalIgnoreCase)) { |
There was a problem hiding this comment.
Relatedly: the .OrderBy() is particularly useful now; see also: https://github.com/xamarin/java.interop/pull/442/files#r303698944
A batch of commits that make generating the type
.csfiles thread-safe, and enables writing them in parallel. On my 6 core machine, this reduces time taken generating the types inMono.Android.dllfrom ~31s to ~5.2s.