Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance optimization: check for python float before type-checking…
… numpy. Checking whether the object is a numpy array checking is pretty expensive, so we only want to do it when the object is not trivially a float. This makes appending to a repeated field of float ~3x faster in a common case: ``` _bench_append, 1000000, 284.1 _bench_extend, 1000000, 209.0 _bench_assign, 1000000, 175.8 _bench_pybind11, 1000000, 3.7 ``` ``` _bench_append, 1000000, 128.4 _bench_extend, 1000000, 67.1 _bench_assign, 1000000, 57.2 _bench_pybind11, 1000000, 3.5 ``` PiperOrigin-RevId: 707811151
- Loading branch information