dmlc / minpy

NumPy interface with mixed backend execution
https://minpy.readthedocs.io/en/latest/
Other
1.11k stars 112 forks source link

Fix op Stat #162

Closed Taco-W closed 7 years ago

jermainewang commented 7 years ago

Can we do it during package loading time? To reduce the call overhead, current package will decide which function to use upon the package is loading. Wrapping __getattribute__ will add another indirect call for every function calls in minpy.

jermainewang commented 7 years ago

Hmm, take back my comments. It is impossible to count how many times a function is called upon package loading time. Then, how about an alternative solution. Can we have a switch in the environment like a DEBUG flag that once turned on, it will decide function dynamically? Then we can count the usage at that time. It will become slower, but will only be used for debugging.

Taco-W commented 7 years ago

a quite reasonable advice. I'll of course add the DEBUG flag thing!

Taco-W commented 7 years ago

@jermainewang please check