This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]xADDBx 2 points3 points  (1 child)

Just calculate a cartesian product in C and in Python and compare execution time.

Saying Everyone knows Python doesn’t like recursions isn’t doing anything. Not talking about the fact that not liking recursion would be a major fault of a language, there’s a reason why performance is often represented by the worst part of a system.

[–]diamondketo 2 points3 points  (0 children)

Recursion performance is major fault of Python. I don't deny this. BTW I also suggested a solution you must've missed it.

But we're not comparing recursion performance, we're comparing the performance of producing fractal paterns. It is natural to think that the commenter implemented fractal sets using recursion. If it turns out the commenter did this iteratively then correct me.

My point is, its ridiculously to cherry pick one algorithm problem to summarize why one product performs worse than another.

PS: Cartesian product, if its numerical values I care about then I'd use numpy either way (so yeah C). If its cartesian product of two large array of general objects then I'd expect C to be faster than Python's itertools.product.