-
Notifications
You must be signed in to change notification settings - Fork 241
Proposal: QualifiedMethods #991
Comments
This sounds fine design-wise, but I'd be concerned about the performance implications. Any thoughts on how we can minimize how many layers of function calls it adds and cut down on any indirection? |
Such method in initial implementation may add only one additional layer to normall call through signature (and will not add anything if compare with call through InterfaceMethod). Direct call of such objects will be nearlt same as current method call without signature. Really, it may even give us some benefits - if we change our method signature caching algorithms to always use them with in-function caching, our function invocation cache will be always (except variance interface calls) switch with one case and created after first method call. |
I'll do some benchmarks to understand better if it affects call perfomance. |
I've implemented extended InterfaceMethod to work with all non-static functions (static will add later). Each type now holds InterfaceMethods for each instance method. Using them to call methods add no overhead comparing to calling method through signature - and even have some benefits, as each InterfaceMethod correspond with only one method overload. So, we don't need use inline cache anymore for all except variance calls. |
Based on my work on #988 and thoughts on #185, #623 I'd like to propose next:
Let's introduce QualifiedMethod. Qaulified method will
this
reference and return function, thatCall
method, that will accept this reference, generic argumetns and method arguments in single call for perfomance-optimised callsOf
method, that will accept same arguments, as MethodSignature and return QualifiedMethod with stored MethodSignature.Such organisation will allow us later solve #185, #623, #990 and provide statically-typed way to call any method with specified signature from TypeScript code.
The text was updated successfully, but these errors were encountered: