Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU consumption #1

Open
mh1412 opened this issue Sep 29, 2020 · 2 comments
Open

High CPU consumption #1

mh1412 opened this issue Sep 29, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@mh1412
Copy link
Contributor

mh1412 commented Sep 29, 2020

Overview

Running the library will consume 70% CPU time on an i7 10th Gen CPU.
Library need to be optimized to to consume less CPU resource

How to reproduce

  • Start point cloud viewer server using tau-lidar-camera module
  • Start activity monitor (on Mac computer)
  • Observe Python process is consuming 70% CPU

Screen Shot 2020-09-29 at 6 43 14 PM

@mh1412 mh1412 added the bug Something isn't working label Sep 29, 2020
@mh1412 mh1412 changed the title High CPU consumption and low frame rate High CPU consumption Sep 29, 2020
@vsemi
Copy link
Collaborator

vsemi commented Nov 3, 2020

I thought Zheng mentioned solved by he modifying the javascript in UI. Or not?

@ziguana
Copy link

ziguana commented Jan 5, 2022

I am not a Python expert, but I think the issue is in _calcCrc32Uint32(crc, data). When crc is shifted left, it needs to be truncated with & 0xFFFFFFFF, or it gets turned into a big int and grows quite large.

def _calcCrc32Uint32(crc, data) :
crc = crc ^ data
for i in range(32) :
if crc & 0x80000000 :
crc = (crc << 1) ^ POLYNOM
else :
crc = crc << 1
return(crc)

I traced the value of crc on a 10-byte command and it topped out at 9041709683971943732904854826748712756544968371426423194332838811441949002642410130889108712225116206824332. I imagine the issue is much worse on larger messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants