• csm10495@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    20
    ·
    2 months ago

    It’s exciting, but man there are lots of assumptions in native python built around the gil.

    I’ve seen lists, etc. modified by threads assuming the gil locks for them. Testing this e2e for any production deployment can be a bit of a nightmare.

  • BB_C@programming.dev
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    2 months ago

    While pure Python code should work unchanged, code written in other languages or using the CPython C API may not. The GIL was implicitly protecting a lot of thread-unsafe C, C++, Cython, Fortran, etc. code - and now it no longer does. Which may lead to all sorts of fun outcomes (crashes, intermittent incorrect behavior, etc.).

    :tabclose

    • vrighter@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      ·
      2 months ago

      those libraries include pretty much almost all popular libraries. It’s just impossible to write performant code in python.

  • fubarx@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 months ago

    I have a project ready to try this out. It’s a software simulator, and each run (typically 10-10,000 iterations) can be done independently, with the results aggregated and shown at the end. It’s also instrumented to show CPU and memory usage, and on MacOS, you can watch how busy each core gets (hint: PEGGED in multicore mode).

    Can run it single-threaded, then with multiprocessing, then with multi-core and time each one. Pretty happy with multicore, but as soon as the no-GIL/subinterpreter version is stable, will try it out and see if it makes any difference. Under the hood it uses numpy and scipy, so will have to wait for them.

    Edit: on my todo list is to try it all out in Mojo. They make pretty big performance gain claims.