Open willmcgugan opened 4 months ago
These are the binary searches I found:
rich/cells.py::_get_codepoint_cell_size
rich/cells.py::set_cell_size
rich/text.py::Text.divide
tools/make_terminal_widths.py
(irrelevant)Segment.divide
and Segment._split_cells
use a linear search that could potentially benefit from binary search.
I implemented a few binary searches in Rich, such as getting the cell length of a character. I wonder if we can replace those binary searches with the
bisect
module. If that is implemented in C, which I imagine it is, then it could be a speed win.Suggest we try it, and if it works profile the improvement (if any).