HNHacker News
TopNewBestAskShowJobs

ngoldbaum

4,068 karma · joined April 22, 2013

submissionscomments
ngoldbaum··on Python 3.15
It should be good to go, but of course I don’t know what your codebase looks like and issues are always possible in any code, “good to go” or no. Please do give it a try and try testing on 3.15 and 3.15t.
ngoldbaum··on Python 3.15
I’m glad to see there’s ongoing work to get protobuf working!

I doubt PyUnstable APIs will get promoted directly to the limited API without at least a release or two in the regular version-specific API first.

That said, if you would be willing to start a thread on discourse describing your need and use-case, that is probably the first step to stabilizing the APIs you want. It may also turn out there’s an alternate way to get protobuf working.

Please do feel free to reach out privately. I’d love to be able to chat with people working on protobuf and grpcio, they come up reasonably often and it’s hard to get official updates from inside Google.

ngoldbaum··on Python 3.15
My headline feature is the new “abi3t” stable ABI for the free-threaded build. While Petr Viktorin did most of the CPython implementation, I’ve been trying to make sure ecosystem support is ready. It’s been a rewarding but quite challenging project to make sure everything is working. There were some late nights leading up to the beta1 release when we found a Windows-specific issue that needed a fix.

I’m particularly proud that the cryptography project is already shipping a single abi3.abi3t wheel for each platform on Python 3.15 or newer. The GIL-enabled build and free-threaded build can both use the same wheel now, because PyObject is opaque.

If you want to learn more about this, I gave a talk at EuroPython this year on Python’s ABI and the road to building and releasing abi3t today. See https://youtu.be/An8lO29SxXE.

ngoldbaum··on Scaling NumPy on Free-Threaded Python
I’m saying that it’s a new issue on the free-threaded build.
ngoldbaum··on Scaling NumPy on Free-Threaded Python
There’s also the fact that INCREF and DECREF on shared objects is a lot more expensive than plain integer addition, so stuff becomes a bottleneck that was never a bottleneck. Kumar also fixed a bottleneck caused by a lock added only for safety on the free-threaded build. It’s hard to tell in advance than a fancy lock-free data structure is needed for something.
ngoldbaum··on Scaling NumPy on Free-Threaded Python
I’m not sure why it took me, a NumPy developer, looking at the benchmark numbers and saying “hmm, this is a bug”. But that is what it took. People are sometimes slow to treat behavior in dependencies like NumPy as bugs.
ngoldbaum··on What Every Python Developer Should Know About the CPython ABI
I’m glad you enjoyed the post. It really helped me to crystallize my understanding. I was also confused about the API/ABI distinction for a long time.
ngoldbaum··on What Every Python Developer Should Know About the CPython ABI
Thanks for pointing that out, I’ll fix that.
ngoldbaum··on GitHub was having issues
I wonder why the github status page has an atlassian cookie request pop-up.
ngoldbaum··on Ty: A fast Python type checker and language server
Either something about beanie babies or something riffing on "thank you". Couldn't ever make up my mind then basically forgot about it.
ngoldbaum··on Ty: A fast Python type checker and language server
I gave away the “ty” project name on pypi to Astral a week or so ago. I wanted to use it for a joke a few years ago but this is a much better use for a two letter project name. They agreed to make a donation to the PSF to demonstrate their gratefulness.
ngoldbaum··on Branchless UTF-8 Encoding
You could do two passes over the string, first get the total length in bytes, then fill it in codepoint by codepoint.

You could also pessimistically over-allocate assuming four bytes per character and then resize afterwards.

With the API in the linked blog post it's up to the user to decide how they want to use the output [u8;4] array.

ngoldbaum··on My NumPy year: Creating a DType for the next generation of scientific computing
The main difference is the strings are stored in a single contiguous arena buffer (with some minor caveats if you mutate the array in-place). With object strings each string has its own heap allocation.

More details in NEP 55: https://numpy.org/neps/nep-0055-string_dtype.html

This post is based on the content of a 25 minute talk and it’s hard to explain everything fully…

ngoldbaum··on My NumPy year: Creating a DType for the next generation of scientific computing
Ah I could see how that’s confusing. I was trying to indicate that the size stored for the string in the example is 28, but it’s stored in a 64 bit uint.
ngoldbaum··on My NumPy year: Creating a DType for the next generation of scientific computing
They’re stored on the DType instance. This requires that there’s only one DType instance per “owned” array buffer, which I figured out how to do along with Sebastian Berg and others using the new DType system.
ngoldbaum··on My NumPy year: Creating a DType for the next generation of scientific computing
That is something I’d like to see but I don’t want to wade into the already very complicated discussion around arrow strings in pandas. If a Pandas developer wanted to take this on I think that would make things easier since there’s so much complexity around strings in Pandas.

That said there is a branch that gets most of the way there: https://github.com/pandas-dev/pandas/pull/58578. The remaining challenges are mostly around getting consensus around how to introduce this change.

If NumPy had StringDType in 2019 instead of 2024 I think Pandas might have had an easier time. Sadly the timing didn’t quite work out.

ngoldbaum··on My NumPy year: Creating a DType for the next generation of scientific computing
This was a case of convergent evolution, both projects ended up working simultaneously on similar ideas.

One issue with using Arrow directly in NumPy is PyArrow exposes an immutable 1D array, while NumPy exposes a mutable ND array.

See also https://numpy.org/neps/nep-0055-string_dtype.html#related-wo...

ngoldbaum··on My NumPy year: Creating a DType for the next generation of scientific computing
Well, there was no concept of sidecar storage. Now we have the hack we came up with for StringDType to store data on the DType instance and also make it so StringDType arrays don't share StringDType instances, unless the array is a view.

EDIT: looking back at the NEP, I'm not sure it does a great job explaining exactly how the per-array descriptor works. Ultimately it's powered by a hook in the DType API: https://github.com/numpy/numpy/pull/24988. There is only one spot in NumPy where array buffers are allocated, so we hooked there and made sure any arrays with newly allocated buffers get a new DType instance.

ngoldbaum··on My NumPy year: Creating a DType for the next generation of scientific computing
Thank you this really means a lot.
ngoldbaum··on The Fastest Mutexes
No, it wouldn’t make sense to. Use threading.Lock for that. PyMutex is available in the CPython C API.
ngoldbaum··on The Fastest Mutexes
https://github.com/numpy/numpy/issues/26510#issuecomment-229...

And now that I look at that again I realize I forgot to finish that up!

ngoldbaum··on The Fastest Mutexes
This style of mutex will also power PyMutex in Python 3.13. I have real-world benchmarks showing how much faster PyMutex is than the old PyThread_type_lock that was available before 3.13.
ngoldbaum··on Anaconda sued Intel for copyright infringement over AI software
The complaint [1] is linked in the article. They're suing over Intel internally using and redistributing the anaconda software distribution.

[1] https://fingfx.thomsonreuters.com/gfx/legaldocs/znvnxomagvl/...

ngoldbaum··on Free-threaded CPython is ready to experiment with
Clarifying a few days later: single-threaded performance in the normal ABI with the GIL does not have the same performance degradation. You only see the performance hit if you’re testing the experimental 3.13 free-threaded release.
ngoldbaum··on Free-threaded CPython is ready to experiment with
It’s an experimental release in 3.13. Another example: objects that will have deffered reference counts in 3.14 are made immortal in 3.13 to avoid scaling issues from reference count thrashing. This wasn’t originally the plan but deferred reference counting didn’t land in time for 3.13. It will be several years before free-threading becomes the default, at that point there will no longer be any single-threaded performance drop. Of course that assumes everything shakes out as planned, we’ll see.

This post is a call to ask people to “kick the tires”, experiment, and report issues they run into, not announcing that all work is done.

ngoldbaum··on Free-threaded CPython is ready to experiment with
Right now there is a significant single-threaded performance cost. Somewhere from 30-50%. Part of what my colleague Ken Jin and others are working on is getting back some of that lost performance by applying some optimizations. Expect single-threaded performance to improve for Python 3.14 next year.
ngoldbaum··on NumPy 2.0
We had a developer meeting to discuss what should go into 2.0 in April 2023: https://github.com/numpy/archive/tree/main/2.0_developer_mee...
ngoldbaum··on Atomic nucleus excited with laser: A breakthrough after decades
Teeny nit, the sun produces light well into the x-rays (mostly from the corona though). You're probably talking about sunlight making it through the atmosphere.
ngoldbaum··on Pipe Dreams: The life and times of Yahoo Pipes
The owner, tod sacerdoti, is using it to scrape top stories from lobste.rs and submit them to HN as a karma arbitrage pump. Search todsacerdoti on https://gerikson.com/hnlo/ to see what I’m talking about. Judging by the amount of HN karma he’s accumulated it seems to work very well.
ngoldbaum··on Kolibri OS: fits on a floppy disk, programmed using interrupts
If you like the art you should try and play Cosmic Osmo! It was my favorite game to play on the Performa PowerPC macs my elementary school had. It’s a very short and silly game made with hypercard. The creators later made Myst using the same technology.
Page 1 of 12Next →