)]}'
{
  "commit": "dd73c5d190e9cd08f88f9b616c321e10511b81ba",
  "tree": "5c5bb54132bb4e02faeec99f612833d60f51ad52",
  "parents": [
    "295e3aa83bcb6822495ecd49e000df56a067247b"
  ],
  "author": {
    "name": "Jukka Lehtosalo",
    "email": "jukka.lehtosalo@iki.fi",
    "time": "Fri Nov 20 11:38:39 2026 +0000"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Nov 20 11:38:39 2026 +0000"
  },
  "message": "[mypyc] Use CPython bytes \u0027in\u0027 search if first byte gets many hits (#22528)\n\nThe memchr + memcmp search that was added in #22409 is fast on typical\ndata, but when the first byte to search for is frequent, each iteration\nmakes little progress. This seems fairly common, but in the worst case\nthis was ~9x slower than CPython.\n\nFall back to CPython search algorithm if there are many first byte hits\nthat don\u0027t match the whole search string. On Python 3.10 we need to fall\nback to PySequence_Contains, but on newer versions there is a private\nCPython API we can use.\n\nBenchmark results on Linux x86-64 (time relative to master, lower is\nbetter):\n\n * 1 MB Python source, `b\"    raise NotImplemented!\"` (miss): 0.12x\n * `b\"a\" * 100_000`, `b\"ab\"` (miss): 0.11x\n * Short inputs (8-80 bytes): 0.86-0.99x\n\nThe worst case is a dense region followed by a long sparse one, e.g.\n`b\"a\" * 200 + b\"x\" * 1_000_000` and `b\"ab\"`, which is now about as slow\nas the generic CPython search (~35x slower than master).",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "bf6be2a31b6a2f7eb46a8c7706c3008d2167ce69",
      "old_mode": 33188,
      "old_path": "mypyc/lib-rt/bytes_extra_ops.c",
      "new_id": "45e2e844af6688a0f957a9d29f3f43d1b240e1ed",
      "new_mode": 33188,
      "new_path": "mypyc/lib-rt/bytes_extra_ops.c"
    },
    {
      "type": "modify",
      "old_id": "b7f11e894ffcc63502dea728f6da7a65e5291498",
      "old_mode": 33188,
      "old_path": "mypyc/test-data/run-bytes.test",
      "new_id": "139b1dac21efdf72f94ea7957191dae2fa8d401b",
      "new_mode": 33188,
      "new_path": "mypyc/test-data/run-bytes.test"
    }
  ]
}
