News for hackers. Stuff that matters.
Re:D for the Win by blt on Friday August 22, 2014 @10:49AM (#8212315)
"Write in Python/Ruby/whatever and optimize the slow parts in C" echoes around the programming community endlessly, but I wonder how many people have actually done it. It's kind of hard.

- Automated tools like SWIG have weird limitations and are complex.

- Binding to a C library manually means you have to wrangle the data from a heapy, pointery dynamic language world into whatever format the C libary wants.

- Writing the C code to operate on the dynamic language's objects directly means you have to learn how the language works under the hood, and your C code will never be useful in any other language.

- Python and Ruby both have a GIL that prevents you from using multithreading to its full potential.

- The way dynamic languages lay out objects in memory causes an inherent slowness everywhere. Your app's slowness may well be a death of a thousand cuts, with no easily optimized hot spot.

I think anyone who has actually worked on a project built this way will appreciate the idea of a compiled language that is closer to the expressiveness of Python.

Re:D for the Win by thinkpad20 on Friday August 22, 2014 @10:52AM (#8212334)
This isn't an assertion, just a question: isn't that exactly the reason why Cython exists, both to more easily facilitate the connection between Python and C, and to create essentially "a compiled language that is closer to the expressiveness of Python"?
Re:D for the Win by snth on Friday August 22, 2014 @11:24AM (#8212494)
Yes.
Re:D for the Win by awakened on Friday August 22, 2014 @11:04AM (#8212396)
I have done it a lot. However, I optimized the slow parts in C++ with Boost Python, not C. It is not hard and it works great and is well documented.
Re:D for the Win by wobbleblob on Saturday August 23, 2014 @02:15PM (#8216440)
Writing your application in Python/Ruby/Whatever and optimize the slow parts in C sounds like a good way to have the worst of both worlds: the lack of efficiency of the interpreted language combined with long development time, difficulty porting, buffer overruns and segfaults of C programming.
Re:D for the Win by angersock on Friday August 22, 2014 @12:02PM (#8212655)
V8 + C++ has served me pretty well; C and Lua likewise.
Re:D for the Win by jacques_chester on Saturday August 23, 2014 @10:53AM (#8215932)
Lua bindings are so wonderfully straightforward. A happy consequence of the design goals.