Scientific computing using D

jmh530 john.michael.hall at gmail.com
Tue Mar 17 10:28:00 UTC 2020


On Tuesday, 17 March 2020 at 06:02:25 UTC, 9il wrote:
> [snip]
>
> Mir is not the libraries for scientific research on a PC as 
> well as the whole D isn't the best choice for that. Python is 
> better for this kind of stuff. If you just like D, it isn't a 
> good reason to use it. Use D if you don't have other choices 
> because of technical reasons. D offers what other languages 
> can't and sometimes it is the only good choice an engineer has.
>
> Ilya

I think it is useful for anyone to think about their use case and 
whether the programming language is the best tool to use.

I am often more productive in Python/Matlab/R for small projects 
that do not take long to write and where the code does not need 
to run for a long time. Knowing nothing about what the OP is 
doing, I would say start there.

However, if they are doing something that starts to run into the 
limitations of those languages, maybe they are doing something 
that uses a lot of memory or the code takes a long time to run, 
then they should start thinking about what the bottlenecks are. 
Sometimes with python, you might find the the bottleneck is 
actually some C code that numpy is calling. In which case, the 
improvement in performance may not be so large by using D 
instead. Other times, you can use something like cython to 
improve performance. However, then you start mixing C and Python 
in your code and then you might wonder why not do it in C first?

I considered using D because I was writing code that took several 
hours to run and sometimes ran into memory problems. I also 
didn't want to use C, and I couldn't stand the template system in 
C++. It has been good to learn D. I think I've gotten a better 
handle on many other programming languages because of it. 
However, I'm not sure I've saved as much time as I expected.


More information about the Digitalmars-d mailing list