I've apparently managed to trigger a pathological case in the python GC, as 19 minutes in the runtime of my 24-minute script is happening after my last line of code completes
@foone GC problems can be fun (i.e. hard/aggressive) or simple (i.e. lazy/refcount) 😊 i'm not familiar with how py does it, but they'll all likely behave quite similarly.
new plan: we process the data then segfault the interpreter
@foone Couldn't you call kill -9 as an external process to have the kernel just flatline the interpreter (and catch the kill signal in whatever's calling your script and wave it away as terminating as intended)?
the root problem here with this script is that it really should have a nice normalized database it can query against, on a database server with lots of RAM that keeps all the rows cached at all times.
UNFORTUNATELY that's not the case, so I'm doing it batch-style, which is making this iterative programming a fucking nightmare of latency
every time I do a run I have to let it load 11gb of rows into RAM which is never going to be fast no matter how you do it
although with a hot cache and os._exit() I've got it under 4 minutes
I COULD maybe do something slightly janky where I do all my iterative testing inside a REPL where I keep the data loaded and just do my testing from there, but then I have to write code in a REPL which I'm not exactly a fan of
I could write a script that loads the data, then loads a small script that just contains an eval_iterative_coding_bit.py module, which I can send a signal to re-evaluate.
but I don't know if writing the code to hot-reload a module will be worth the time
hey did you know you can create attributes on python objects which have dots in their names?
that is, object foo can have an attribute of "bar.baz" ?
that can't be accessed with foo.bar.baz, because that tries to access bar on foo, which doesn't exist?
DON'T FUCKING DO THIS
>>> class Object:
... pass
...
>>> obj=Object()
>>> setattr(obj,'foo.bar','hi')
>>> obj.foo.bar
Traceback (most recent call last):
File "<python-input-4>", line 1, in <module>
obj.foo.bar
^^^^^^^
AttributeError: 'Object' object has no attribute 'foo'
@foone how hard would a rewrite in a non gc language take? I recently had a 500x improvement in a data conversion pipeline by rewriting in C.
It is not clear to me if your 14 minute script is a lot of code, or just a lot of cycles + a hugely inefficient gc step.
@foone I’ve seen someone break python debugger too. Though in Python’s defense the original code essentially double-implemented inheritance and made it conditional somehow. It was a mess.
which is exceptionally impressive since this all started in an attempt to improve the runtime of a 14 minute script