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
P
Protobuf Team Bot committed
9e44913d434426d4e3dbccbc8ad26ea2c4edd382
Parent: 0d47a29
Committed by Copybara-Service <copybara-worker@google.com>
on 12/19/2024, 8:28:49 AM