Lurker News

Comments (86) 18 threads

Show all comments

Showing thread 1 of 18

lunixbochs3 replies#
Note: this was implemented without referencing any ZFS source code and should not be subject to the CDDL.
josteink2 replies#
So we port this python to something not slow, and all the kernel-people can shut up about ZFS being terrible ;)
j88439h846 replies#
Dont forget, pypy is fast.
spullara1 reply#
Faster that CPython doesn't mean it is fast.
twa9275 replies#
I was trying to speed up a log processing service running on PyPy by rewriting it in Java. I was surprised that the result was about twice slower (I know Java quite well and I didn't see obvious optimizations; most of the time was spent in GC). So it can be quite fast even in more absolute terms (VM languages), at least for some types of code.
spullara#
If more than 1% of your time is in GC you are doing something very wrong.
tigershark7 replies#
I know that it’s asking a lot, but any chance that you can post a minimum reproducible sample? From what I know it is quite smelly...

Continue this thread — 7 replies

michaelmrose#
The fact that a singular implementation was better than java says less about the languages and more about the particular software.
int_19h1 reply#
I had a binary parser written in Python that took around 30 seconds on typical input on CPython. PyPy took that down to about 10 seconds. Rewriting it in C# took it down to 200 ms.
twa9271 reply#
If this was using a loop processing a single byte in an iteration I would expect a greater speedup on PyPy. I've seen 100x speedup in such cases.
int_19h1 reply#
Not single byte, but individual fields (float32/int32/string etc). Yes, I expected a much more significant speed-up as well. It's probably because a lot of that code was driven by reflection-type techniques.

Curiously, IronPython did better than anything (but still slow). Haven't tried Jython.
Compiling the whole thing with Cython was less effective than PyPy.

twa927#
Yes, reflection voids many JIT paths in PyPy, AFAIK. Maybe it was worth rewriting the Python code to get rid of the reflection?
cure12 replies#
PyPy is faster than Python, yes. But Go, C and many other (compiled) languages are way faster than PyPy. Plus, if you use a language like Go or Rust then you avoid Python's GIL and you'll have much more reasonable memory usage. Best of all, deploying is a matter of copying a binary, rather than having to deal with the absolute disaster that is Python packaging.

Continue this thread — 12 replies

tanilama#
Only when comparing to CPython
fragmede4 replies#
pypy is fast, but even were this written in C, there's still the kernel-userland boundary to contend with.

Continue this thread — 4 replies

GuB-42#
Maybe plenty fast for most applications but a filesystem is not one of these IMHO, especially for something as naturally resource hungry as ZFS.

A good filesystem implementation requires tight memory management and good control of what happens at the OS level. I am not saying it can't be be done in python, but it clearly isn't the right tool for the job.
I meant that for a production implementation. Python is perfectly fine for a proof of concept, in fact, it may be better than jumping straight down to C. But keeping it for production is foolish IMHO.

mehrdadn1 reply#
I routinely fail to get speedup on PyPy. In fact I frequently get slowdowns. I imagine it's only fast if your code is slower than it needs to be to begin with.

Continue this thread — 1 reply

aidenn0#
I can Port from Python -> Common Lisp at a rate of ~100 LoC per hour, and that's a pretty friendly port (the yield expression is the only thing that can't be just done line-by-line; truthyness is the only real "gotcha" as there are a lot of "false" values in Python, but only 1.5 in Lisp[1]).

1: I say 1.5 because there is only one false value, but it has 2 idiomatic meanings: nil (equivalent to python's None) and the empty list.

newnewpdro2 replies#
Would the CDDL matter for a python implementation that will never become part of the kernel?
dr0verride1 reply#
It's clear to me that the solution is to integrate python into the kernel.
yjftsjthsd-h1 reply#
I assume you mean this as a joke, but I would point out that at least one of the BSD family has gone and baked lua into their kernel. Granted, lua is rather meant for that kind of thing and python isn't, but it is entertaining to point out an interpreted language that has been stuck into a unix kernel:)

Continue this thread — 1 reply

CaliforniaKarl2 replies#
You'd want a reverse-engineering lawyer, so be certain. But my (IANAL) guess is: If this is a proper reverse-engineered implementation, you could then convert _this_ implementation to C, and contribute _that_ into the kernel.

Except, it seems this is BSD-licensed, so I'm not sure how that would work in the kernel (which is GPLv2).

lunixbochs1 reply#
BSD is a subset of GPL's restrictions, so you can include BSD-licensed code in a GPL work.

Continue this thread — 1 reply

loeg#
BSDL code is fine in the GPLv2 kernel. E.g., most of the DRM drivers are dual BSD-GPL licensed.
lelf1 reply#
Bad title. It’s not a ZFS implementation, so hold your horses.
AHTERIX5000#
What do you mean? Can't you mount & read ZFS filesystems with this one?