Skip to content

v6.10.9

Latest

Choose a tag to compare

@wallneradam wallneradam released this 09 Oct 21:00
· 6 commits to main since this release

Performance

AST transformation pipeline

  • Transform time roughly halved: on a set of 120 real-world scripts the total transform time dropped from about 34 s to 16 s (median 64 ms -> 29 ms per script). The emitted code is byte-identical; only baked record constants differ.
  • Fused passes: several transform rules now run in a single tree traversal while each rule stays its own class. SafeConvert, SafeDivision and FloatTolerance form the first fused phase. PYNE_AST_SEQUENTIAL=1 runs them as separate passes (the reference a fused phase must reproduce).
  • Redundant and super-linear traversals removed across the passes (the request.security family and slicing, Pine type inference, constant folding, lowering), a faster AST walk and clone, and garbage collection paused during a transform.
  • Pipeline declared as data: the steps, their order and the reason for each position live in transformers/pipeline.py. PYNE_AST_TIMING=1 prints the wall time of every step to stderr.

Fixes

Bytecode cache correctness

  • Pipeline hash now covers the constant-folding implementations and the calling interface of the runtime helpers the emission calls, so a change there invalidates cached bytecode.
  • Dependency routes: dependency records carry a routes digest, so a library function that starts or stops keeping state invalidates its dependents. Every module-level import of a Pyne module, and plain modules a route resolves through, are tracked as dependencies.
  • pynecore.lib routes and __all__ are read from the generated lib_types.json (scripts/lib_type_collector.py); a test fails until the committed registry is regenerated.
  • Module interface baked into the .pyc: a module's published interface is stored in its own bytecode (__pyne_interface__). The separate .pynetypes.json artifact and the PYNE_TYPE_ARTIFACT variable are removed. A dependency without a current .pyc is compiled into one once and reused by its import.

Transforms

  • Reserved emitted names: Pyne code that binds or reads one of the plain double-underscore names the transform emits (e.g. __state__, __cmp0__, __pyne_*__) is now rejected with a source-located SyntaxError instead of silently colliding with the generated code.
  • TYPE_CHECKING stripper: aliases of the flag and of the typing module are resolved by lexical scope, other reads of the flag are replaced with False, and nested guards are handled.

Broker / live trading

  • Cancel-tentative probe count reset on transport failure: a cancel probe that raised OrderDispositionUnknownError never reached the venue, so it no longer counts towards the halt while the periodic reads are still confirmed. Only a probe the venue answered is counted; a raised probe resets the count.

Documentation

  • docs/advanced/ast-transformations.md rewritten around the declarative pipeline, with a test that keeps its step tables in sync with pipeline.py. Function isolation, request.security internals, debugging and script format pages updated accordingly.