On Thursday, 24 April 2014 at 06:38:42 UTC, Suliman wrote:
I am following discussions about GC and some other 'critical' improves in D language for a long time. I see a lot of arguments and heaps of code, that often hard to understand (for example Templates) even more complicated to use it.

I like D, but more and more I am playing with Python, and understanding it's philosophy. And I like it because it's do not have any overhead like C++. It's clean any easy to understanding. As result it's harder to write bad code in it.

Does anybody make tests of speed most common algorithm in D and Python. I am trying to understand which project better to start in Python and which in D.

I'm completely new to D, but have been writing in python for quite a while. Python is a very good language but it can be slow. I've noticed that anything involving bit shifting is very slow.

On one project I had a CRC algorithm in a python program that had to read a 2 megabit/sec datastream, calculate/compare CRC's and write data to disk files based on encoded times. The calculation involved bit shifting and the program couldn't keep up with the input stream at 96% CPU utilization. I implemented the CRC calculation in C (with almost no change to the algorithm), and added a python binding, leaving the rest of the python program unchanged. CPU utilization dropped to 4.5% and I was able to keep up with the input stream, no problem.

In general I guess that anytime you need native performance write the program in D. If it doesn't matter one way or the other write in D because you can deliver a binary with no dependency on an interpreter. But if you know that the python interpreter will be available on the target system, and you need to make use of the extensive python standard library, and your program isn't multi-threaded, then use Python.

Reply via email to