rosnodejs icon indicating copy to clipboard operation
rosnodejs copied to clipboard

bad deserialize perfomance with image data array

Open panshengjie opened this issue 6 years ago • 4 comments

I've check the source code, In

deserializeInnerMessage (message.js)

reading buildin-type array one-by-one using buffer.readUInt8 ,eating-up the CPU.

panshengjie avatar Oct 22 '18 06:10 panshengjie

I believe you've stumbled on a case where we didn't update the on-the-fly message code to work the same way as the pre-generated messages. The generated messages specifically deal with uint8 arrays by slicing out a section of the overall message buffer rather than iterating over the length of the array.

chris-smith avatar Oct 22 '18 12:10 chris-smith

@panshengjie thanks for reporting. Do you have a canonical code example to reproduce this? That would help us fix this more promptly.

chfritz avatar Nov 12 '18 05:11 chfritz

@chfritz I was subscirbed to a image topic, with type sensor_msgs/Image, and found a significant rise on cpu usage

panshengjie avatar Nov 12 '18 05:11 panshengjie

for uint8 array, I've forced converting buffer to Uint8Array . BUT this is not a general resolution, may lead to compatibility issues

panshengjie avatar Jul 01 '20 02:07 panshengjie