News for hackers. Stuff that matters.
Re:Making Cython as easy as Python by python_que on Tuesday September 22, 2015 @03:44AM (#10257188)
I am using Python to solve combinatorial problems, and so my code relies heavily on the itertools library.

My question is if I would still get a considerable speed-up if I rewrite some of my code in Cython, given my reliance on itertools?

Re:Making Cython as easy as Python by versteegen on Tuesday September 22, 2015 @04:43AM (#10257405)
As dagw said, if your inner loops aren't inside a .pyx file, then Cython can do little to help. Even if there are, if it involves lots of fiddling with data structures like dicts and lists, or making use of dynamic or high level features of Python like generators or classes or list comprehensions, then Cython would provide only a small speed increase (say, 20%), because almost all the running time will be spent inside the Python runtime. To get the biggest speed ups out of Cython you need to write C-like code with type annotations. E.g. "for x in range(...):" loops.
Re:Making Cython as easy as Python by dagw on Tuesday September 22, 2015 @04:21AM (#10257325)
The calls to itertools won't be sped up significantly. However if then you loop over the results of a call to itertools and do something to each element, then that loop might end up being much faster.
Re:Making Cython as easy as Python by hogu on Tuesday September 22, 2015 @09:55AM (#10258537)
it may be worth checking out cytoolz
Re:Making Cython as easy as Python by mathnode on Tuesday September 22, 2015 @11:15AM (#10259103)
Yup. Cytoolz. Some notes on performance of Cytoolz:

http://matthewrocklin.com/blog/work/2014/05/01/Introducing-C...

Re:Making Cython as easy as Python by python_que on Wednesday September 23, 2015 @05:58AM (#10264153)
great thanks both for the tip.