-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaced class Caller
with struct Caller
#212
Conversation
…bug in the current `Caller` implementation around disposal.
Indeed, this is because we're copying If we don't implement |
Yep, when I was writing my original comment I'd somehow forgotten the change to
This was actually my original intention (see discussion in #208). I did a lot of experimentation with it and found that it mostly worked but fell over in the reflection based cases (calling through reflection boxes parameters and you can't box a |
…epochs to discover if the context is invalid).
This re-introduces the |
With the evolution of the API, I wonder if it would be worth simply eliminating the reflection-based fallbacks entirely in favor of requiring users to use an untyped callback now that they're implemented. That would be quite similar to how the Rust API works (can wrap signatures up to a certain limit, with the type checks performed statically; otherwise, must accept the parameters/returns as slices of "values"). |
That would get my vote. I've been wondering if we should do away with the reflection based callbacks for a while - silently falling back into a significantly slower path felt a bit iffy, I just didn't have a good alternative before the untyped callbacks. |
I think we should take that approach and simplify this PR to a I'm happy to take that change on before the next release if you'd like. |
Sounds good to me 👍 As you can probably tell from my scatterbrained comments it's too late in the day for me to manage it 😄 😴 |
@martindevans so removing the reflection fallback is proving to be a large enough change as to make me uncomfortable for including it in an already-overdue release without it sitting in How important is fixing the |
Also, it appears we can't migrate fully to Defining our own delegate types for each of those overloads is possible, but it makes the API unwieldy. I propose we move forward with this fix (or something similar) and I'll rip out the reflection-based fallback with a future commit past this release window. |
I think we'll need to properly benchmark this change as I'm not convinced that saving on the alloc of a reference type caller outweighs the epoch management to guarantee we can dispose a value type |
Regarding the immediate release, if you want to create it without including the By the way, in order to quickly identify public API changes between releases, the package When creating a release, you would apply the changes from What do you think about adding it to
Personally, I would actually be OK with defining our own What do you think? |
We're going to be releasing our Unity package soon (3-4 weeks, mostly feature freeze next week), likely using whatever the next version of wasmtime-dotnet is. So I'd prefer that it's in the next release. That said, even this PR isn't the whole solution ( On balance I think what kpreisser suggested re. releasing 18020d2 is probably the best approach. We can delay all the
I prototyped this approach (messy prototype work here) and didn't find it too bad. We could easily generate those delegates up to whatever number of parameters we need. As far as I could see this change to the public API seems to be source compatible which is a nice bonus. In the end I abandoned this approach due to the I'm happy to restart this work with an aim to get it into the next release, if that's what we want?
I just threw together a quick benchmark by modifying the Current approach:
Struct+Epoch with
However it's very difficult to properly benchmark this kind of thing and I'm not convinced these numbers are very meaningful. With such a small+simple heap containing only short lived objects the GC is basically guaranteed to win! I also don't know if benchmark-dotnet will even be fully counting the GC time in the numbers. We can probably take these benchmarks as a best possible case for the current approach. |
Superseded by #214. |
Discovered a potential bug in the current
Caller
implementation around disposal. Opening up a draft PR to test with CI.