Hello,
I'm working on a project that involves benchmarking CPython and PyPy
across a few benchmarks I've devised, but PyPy is so much slower than
CPython I feel I must have made some sort of mistake. One major
headscratcher is that CPython runtimes hold stable while PyPy appears
to get worse as the benchmark progresses.
I've included an excerpt of the benchmark below that shows the issue,
if I can attach files that won't be lost I can attach a full copy; I
don't believe the string operations …
[View More]are the issue because the
micro-tuning tips suggest the JIT reduces concatenation overhead in
scenarios like these (if I'm reading the page right). [1]
def recurse(num):
if num >= 1000:
return "M" + recurse(num - 1000)
elif num >= 900:
return "CM" + recurse(num - 900)
elif num >= 500:
return "D" + recurse(num - 500)
elif num >= 400:
return "CD" + recurse(num - 400)
elif num >= 100:
return "C" + recurse(num - 100)
elif num >= 90:
return "XC" + recurse(num - 90)
elif num >= 50:
return "L" + recurse(num - 50)
elif num >= 40:
return "XL" + recurse(num - 40)
elif num >= 10:
return "X" + recurse(num - 10)
elif num >= 9:
return "IX" + recurse(num - 9)
elif num >= 5:
return "V" + recurse(num - 5)
elif num >= 4:
return "IV" + recurse(num - 4)
elif num >= 1:
return "I" + recurse(num - 1)
else:
return ""
-Jeremy
[1]: https://pypy.org/performance.html#micro-tuning-tips
[View Less]
I have a service and companion utilities that runs on both debian and
ubuntu (to start...)
This is linux-specific, requiring root permissions of the server service
since I am making adjustments to file permissions for the purposes of an
extensible archiving system for end-users (the server validates any
requests made over a unix file socket based on a peer's uid and gid, and
manages files for archival for the user -yes, turns out you can get that
info from a file socket on linux; you can'…
[View More]t with a network socket...)
I made a python3 script for the server service and a python3 install
script that sets up everything right for the server service. Because it
is doing some pretty privileged service setup, root permissions are
needed for the installation script. Right now the programs check the
effective uid of the operator, and if it's not root it exits with a
message that root is required (so it could be done with sudo or su...)
Here's an important point: I need to install a few linux packages (my
python install script does that by shelling to apt-get...); I get the
appropriate package names for the distro in question (my install script
consults a file that comes with it...) Right now if the distro is not
debian or ubuntu, it tells the person installing that the distro is
unsupported and exits.
I tried doing a search on this, but I am getting a hell of a lot of
noise in the results. My question is: can pypy be used to distribute a
linux-oriented installer for specific distros such as I describe here?
Can you point me at the documentation to do that, or a good example pypy
package that does something like this?? [Because it is closely coupled
to linux API calls and has to be root, I do not have it use venv...]
I am now also working on distro-specific install packages; but it would
be nice to open access to any and all pypy users...
[View Less]
We've got a library that supports py 3.8 .. 3.12
I though I'd give it a go with newest pypy release, and a couple of unit
tests fail.
I've traced it down to the expectation that objects will disappear from
weakref.WeakKeyDictionary.
In some cases, this is a user-facing thing, we issue a warning for "unused"
resources, by virtue of them missing from the weak container when we expect
the user code to keep the reference around.
Is there a good idiom or some way to support this behaviour with …
[View More]pypy?
Thanks,
Dima Tisnek
[View Less]