Live data from Hacker News

Why is BIND 10 written in C++ and Python?

isc.org

61–70 of 136 posts

Re: Why is BIND 10 written in C++ and Python?

#61
post #23

Earlier quoted context omitted.

Probably because of memory usage and garbage collection and the fact that java needs to be installed on most systems whereas C++ needs no dependencies and python comes preinstalled on the usual linux server (probably not python3 but i assume it will be some years before bind10 sees adoption for such critical infrastructure). Also he mentions specialized data structures and memory management. Atleast i wouldn't sleep…

Probably because of memory usage and garbage collection and the fact that java needs to be installed on most systems whereas C++ needs no dependencies Well, GCC (as in the compiler collection) has had a ahead-of-time compiler for ages: http://gcc.gnu.org/java/ There is also work in the LLVM camp on AOT Java compilation: http://vmkit.llvm.org/ Atleast i wouldn't sleep well if i know that the heart of the internet was…

Neither is a particularly viable option: GCJ is nearly a decade behind mainline Java in terms of feature support. VMKit seems cool but I'm not sure about the maturity of the project.

Re: Why is BIND 10 written in C++ and Python?

#62
post #23

Earlier quoted context omitted.

Probably because of memory usage and garbage collection and the fact that java needs to be installed on most systems whereas C++ needs no dependencies and python comes preinstalled on the usual linux server (probably not python3 but i assume it will be some years before bind10 sees adoption for such critical infrastructure). Also he mentions specialized data structures and memory management. Atleast i wouldn't sleep…

Probably because of memory usage and garbage collection and the fact that java needs to be installed on most systems whereas C++ needs no dependencies Well, GCC (as in the compiler collection) has had a ahead-of-time compiler for ages: http://gcc.gnu.org/java/ There is also work in the LLVM camp on AOT Java compilation: http://vmkit.llvm.org/ Atleast i wouldn't sleep well if i know that the heart of the internet was…

Which ones? I'd say DNS is probably the most important parts. I also don't believe that core routing equipment is running in the JVM.

Apparently you are talking about the "Web", i was talking about the internet or networks in general.. I'm aware that tomcat may have a very large installation base. There is no use for your tomcat if the DNS is down, though :P

Re: Why is BIND 10 written in C++ and Python?

#63
post #35

Earlier quoted context omitted.

There is a python DNS server running on pypy that seems to get a pretty big speedup over CPython. Here is the benchmark result: http://speed.pypy.org/timeline/#/?exe=3,6,1,5&base=2+472... 0.002 for pypy VS 0.015 for CPython, which is 6.66 times faster. So, for the last couple of years they have been wrong - since PyPy has shown pretty good performance in a DNS benchmark, so Python can have pretty good performance ;)

Performance isn't a quality that is either present or not present, it's a quantity you can measure with a number as you did. It's true that pypy is much faster than CPython, but it's also true that C++ is much faster than pypy. Cpython is normally about 2 orders of magnitude slower than C++ on computationally intensive workloads , and if pypy get that down to a single order of magnitude that's great... but not enough…

[citation needed] You're mostly talking nonsense. PyPy is usually 20-100x faster on the numeric workloads I measured than CPython, while the difference is significantly smaller on non-numeric workloads. The difference between C++ and CPython is also smaller.

Re: Why is BIND 10 written in C++ and Python?

#64
post #5

Earlier quoted context omitted.

Why doesn't it look good for python? As far as I'm aware, Python has never been advertised as a top-performance language, and part of the advantage has always been that you can rewrite performance-critical paths in c. Adding to this, the fact that BIND is something pretty performance-intensive, I don't think this makes it look bad at all.

>Why doesn't it look good for python? Because it directly contradicts the "only 20% of your code is performance sensitive and the other 80% can be scripting language X" nonsense that scripting language apologists constantly parrot with no evidence. This is a good example of how scripting languages are in fact not well suited to application development, and should instead be used for scripting.

Or you should use a fast Python interpreter instead of the slow one. The 20/80 (or 10/90 or so) is mostly nonsense in my experience too.

Re: Why is BIND 10 written in C++ and Python?

#66

> "C lacks good memory management" C lets you manage memory without possibly inefficient or even broken magical black box automated processes or garbage collectors. Maybe what the author meant to say was "C lacks easy memory management."

Funny you mention "black box automated process" because, what do you think malloc is? There are two ways of allocating memory directly from the kernel (IIRC), brk and mmap. There's some management malloc does, and if it's good or not depends on you application. For example, size, number and behaviour of your allocations. Depending on your situation you may want to do your own memory management.

You're kind of reinforcing the OP's point though. C does lack easy memory management, unless you're ready to rely on external GC libraries.

Re: Why is BIND 10 written in C++ and Python?

#68
post #39

Earlier quoted context omitted.

As much as I respect and appreciate Pypy, BIND is one of the core foundational pieces of the internet. It needs to be bulletproof and robust. I don't think Pypy itself qualifies as a mainstream enough language for them to build BIND on. This isn't a slight on Pypy, because the core problem is simply that it hasn't been around for long enough and subjected to enough stress to earn entry into the highest of the high ti…

> I don't think Pypy itself qualifies as a mainstream enough language for them to build BIND on. Minor pedantry: PyPy is not a language. It's an alternative compiler/runtime for Python.

I was echoing the terms used in the post. I thought it was clearer than going into a long comment about how Python is mature, at least in its CPython implementation, but the PyPy implementation is not, and when the blog post said "language" they really meant "implementation" because language is not implementation, yada yada yada.

Re: Why is BIND 10 written in C++ and Python?

#70
post #48
post #9

Earlier quoted context omitted.

I can see what you're saying but it's worth contemplating what percentage of the total codebase that Python code would represent if it were replaced by C++ code.

I'm working on a project right now where we're replacing a Qt interface written in Python (PyQt) with C++ Qt as it's way too slow (interface is really laggy), and other than things like having to occasionally delete objects manually (often, if you just add a widget to a layout, Qt does the deletion for you), it's pretty much a 1-1 mapping. We're also replacing core op-graph and geometry processing from Python to C++,…

>in our coding style we're caching begin iterators on the line before the loop

Can you give an example of what this looks like?

Post reply on HN