News for hackers. Stuff that matters.
Re:Making Cython as easy as Python by chuckbot on Tuesday September 22, 2015 @04:46AM (#10257411)
And I hate when people use efficiency when they mean speed.

Python -> Cython speeds up you program but does not change the complexity of your algorithm.

Re:Making Cython as easy as Python by pdabbadabba on Tuesday September 22, 2015 @11:23AM (#10259177)
> And I hate when people use efficiency when they mean speed.

Except they're usually right. "Efficiency" is not just a measure of algorithmic complexity. Something is more efficient if you are able to do more of a desired activity at the cost of fewer resources. The resource in question varies.

Yes, one often in computer science focuses on algorithmic complexity as the resource to be economized on. But time and power are also perfectly reasonable resources to have in mind. In fact, they are the resource that most audiences will naturally assume when they see the word "efficient" standing along, without further explanation.

I think GP is probably wrong to criticize as well -- making code more efficient [or, if you insist, fast] makes it easier to support more users that it could support otherwise. Is the ease with which a system can support an additional user not the very definition of the word "scalability"?

Of course, there are more powerful, and more specialized techniques for improving scalability, but that doesn't mean the author is wrong to suggest that speed improves scalability.

Re:Making Cython as easy as Python by williamstein on Tuesday September 22, 2015 @05:13AM (#10257495)
Sometimes it does. For example if you write a simple O(n) for loop in Python, then convert it to Cython, then compile it, the compiler may replace the for loop by an equivalent O(1) algorithm. I use this to surprise students when benchmarking Cython code for teaching purposes in my SageMath course.
Re:Making Cython as easy as Python by Fede_V on Tuesday September 22, 2015 @05:58AM (#10257626)
If it's just a matter of speeding up a tight loop, I find numba performs admirably and it's a lot more convenient than Cython.

When you need to wrap some c code, or use high-level data structures (that cython handles beautifully with STL integration) that's when it makes sense to drop to Cython.

Re:Making Cython as easy as Python by oliwarner on Tuesday September 22, 2015 @05:01AM (#10257461)
How do you suppose it speeds it up then?

I'll give you "the complexity of your algorithm" likely doesn't change, but how that algorithm is processed is usually more efficient when compiled through C, rather than running through a Python interpreter, if only because of how it's running.

Re:Making Cython as easy as Python by chuckbot on Tuesday September 22, 2015 @05:49AM (#10257597)
I agree it is faster by running it through compiled C code.

Saying "my code is more efficient than your code" might be acceptable, but saying "my code is efficient" drives me mad when it is used as a synonym for "my code is fast". Take a look at [1] and the note that this is not about optimization. Efficient algorithms are usually algorithms with close to optimal time or space complexitiy.

https://en.wikipedia.org/wiki/Algorithmic_efficiency

Re:Making Cython as easy as Python by cbsmith on Wednesday September 23, 2015 @04:50PM (#10268089)
I didn't mention complexity. I said efficiency.
Re:Making Cython as easy as Python by rplnt on Tuesday September 22, 2015 @06:32AM (#10257720)
Efficiency of the user is likely better with this tool.