domenic / get-originals

A web platform API that allows access to the "original" versions of the global built-in objects' properties and methods
28 stars 1 forks source link

Suggested implementation strategy for callOriginalStaticMethod doesn't really suggest anything #6

Closed bzbarsky closed 5 years ago

bzbarsky commented 6 years ago

The hard part is the "existing abilities to find an [sic] execute the backing algorithm behind a given static method".

Again, this can easily end up O(N) in number of methods on the object; it certainly is in Gecko. All the consumers perform aggressive caching of the actual method object involved, but this API has no provisions for being able to do that on the caller side.

domenic commented 6 years ago

Similar to #4, this was also fairly speculative. I'd welcome thoughts on other, more efficient ways to expose this capability; can you think of any?

bzbarsky commented 6 years ago

Again, this is a matter of tradeoffs. You either need to have extra data structures for finding the bits you want quickly (more memory) or you need to cache found bits (more memory) or you end up with a linear scan.

It's not 100% clear what the right tradeoffs will be in all circumstances.