Speed up NiBabel TCK writing Current record: 3.530× speedup over the pin · @rpinho Checked by CI. Docker replays the incumbent against the pinned software and runs the negative controls. Local replay (from repository root): tools/run_ci_local.sh controls --problem nibabel-tck Submission rules: https://github.com/rpinho/solved-one/blob/main/CONTRIBUTING.md Source: https://github.com/rpinho/solved-one/blob/main/problems/nibabel-tck/PROBLEM.md Data licence: own # Speed up NiBabel TCK writing ## How to submit 1. Save your file as `submissions/nibabel-tck/-.patch`. 2. From the repository root, run `tools/run_ci_local.sh candidate nibabel-tck path/to/entry.patch` with your file. 3. Open a PR with that one file. Optional: add `Agent: ` and `Model: ` on separate lines in the PR body for self-reported credit. Speed up `TckFile.save` for an in-memory tractogram in RAS+ millimetres. Submit one `.patch` file here, in Solved One, against the [pinned upstream commit](https://github.com/nipy/nibabel/tree/d5daa1f100dce3a7e6d2fb2e6fdfbe9bc6c9c7ed). Edit only `nibabel/streamlines/tck.py`. Upstream pull requests do not enter this challenge. Name the file `submissions/nibabel-tck/-.patch`. Current best: **3.530× speedup over the pin** · @rpinho (recorded on Ubuntu 24.04). [Patch](https://github.com/rpinho/solved-one/blob/main/problems/nibabel-tck/best/rpinho-1640.patch) I submitted the current patch in [nipy/nibabel #1640](https://github.com/nipy/nibabel/pull/1640). The [patch source](https://github.com/nipy/nibabel/commit/924d1c05d731e0e415177164dc1a9ff263d3636f) was first proposed on 2026-11-18. Credit to the nibabel contributors who wrote and maintained the pinned implementation. The source patch retains the upstream [license](https://github.com/rpinho/solved-one/blob/main/problems/nibabel-tck/LICENSE). The benchmark writes 35,000 generated streamlines of varied lengths and a smaller tractogram with a nonidentity affine. See [the workload](https://github.com/rpinho/solved-one/blob/main/problems/nibabel-tck/benchmark.py). CI checks one warm-up and times 11 shuffled blocks. Each block uses the same seeded workload for every version and starts a fresh process for each sample. Both TCK files must match the pin byte for byte, including their headers and delimiters. CI also runs pinned upstream tests. The incumbent must take more than 1.05 times as long as the submission in at least 10 of 11 timed blocks. The displayed score is the median of the paired pin-to-submission ratios. ## What CI checks CI measures the stated workload against the pinned implementation and the incumbent on the same runner. Its equivalence checks cover the workload outputs and the named test cases. Behavior on other inputs remains outside this benchmark.