Thanks a lot Robert.... The bad thing is that logger.debug() would still incure the costs you mention, even though it would be igonered by the logger in production time.... I guess I should be using DEF and IF to only compile those calls at dev time....
Mohamed. On Fri, May 15, 2009 at 8:21 PM, Robert Bradshaw <[email protected]> wrote: > On May 15, 2009, at 4:22 PM, Mohamed Lrhazi wrote: > >> Hello, >> >> I did an "import logging" in my Cython code, then proceeded to replace >> all my "print" debugging statements with logger.debug(), and then some >> logger.info(), and then stopped to think... >> >> How bad is it for performance to include such frequent calls to a >> standard Python module? I don't understand how Cython works well >> enough, Please clarify. > > It is the cost of a normal Python call (plus running the > corresponding Python code), which may or may not matter relative to > the other things you're doing. In other words, it'll cost about the > same as it would doing it from Python (but you might notice more > because the surrounding code is faster, so it has a higher relative > cost). I certainly wouldn't put it in my inner loops, but a call to > it now and then probably won't hurt. > > Though not as flexible as the logging module, branching on a local > int variable will be orders of magnitude faster. > > - Robert > > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > -- " Logic merely sanctions the conquests of the intuition." Jacques Hadamard _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
