-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: performanceperformance or memory problem/improvementperformance or memory problem/improvement
Description
I've done some profiling and it has shown that using --assert=plain is considerably faster than --assert=rewrite (30% faster in my use case, a real-world scenario with lots of imports).
Using a profiler (http://www.pyvmmonitor.com/) it seems that the slowdown is mostly due to calls to imp.find_module inside of rewrite.AssertionRewritingHook.find_module.
I'll provide a pull request shortly to address this issue by providing an early exit from rewrite.AssertionRewritingHook.find_module when it's certain that a module cannot be rewritten to avoid the imp.find_module call (in my tests, with this change --assert=plain and --assert=rewrite have roughly the same speed).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: performanceperformance or memory problem/improvementperformance or memory problem/improvement