When sending messages that contain numpy arrays of built-in types, it is faster to access array.dtype.char than it is to access array.dtype.name. More information about datatypes in numpy can be found here. This patch adds a check for whether a numpy array contains a built-in type, and if so uses the faster method to obtain the type information. This patch decreases message latency almost 12us (from 35.9us to 24.1us) in a microbenchmark.
This method of accessing the data type is faster because array.dtype.name executes additional Python code as it has to access arbitrary Python strings (in the case where custom types are created/used).
When sending messages that contain numpy arrays of built-in types, it is faster to access
array.dtype.char
than it is to accessarray.dtype.name
. More information about datatypes in numpy can be found here. This patch adds a check for whether a numpy array contains a built-in type, and if so uses the faster method to obtain the type information. This patch decreases message latency almost 12us (from 35.9us to 24.1us) in a microbenchmark.This method of accessing the data type is faster because
array.dtype.name
executes additional Python code as it has to access arbitrary Python strings (in the case where custom types are created/used).