eslavnov / pylips

Control Philips TVs (2015+) and Ambilight (+ Hue) through their reverse-engineered API (+ MQTT support!)
MIT License
342 stars 60 forks source link

[BUG] pylips with set apiv is slow compared to curl #57

Closed popy2k14 closed 4 years ago

popy2k14 commented 4 years ago

Describe the bug pylips with correct set apiv (6) is slow compared to bare metal curl. See results meassured with time:

time curl -X POST --digest --insecure -v -u USER:PW -d '{"key":"VolumeUp"}' https://192.168.0.XXX:1926/6/input/key

Result:


real    0m0.278s
user    0m0.132s
sys     0m0.030s

and here pylips witzh teh same request:

time python3 pylips.py --command volume_up
Sending POST request to https://192.168.0.7:1926/6/input/key
Request sent!
{"response": "OK"}

real    0m1.082s
user    0m0.903s
sys     0m0.056s

To Reproduce see above

Expected behavior pylips is as fast as curl

Additional context Maybe pathon3 is the overhead here? Is there anything i can try to debug the issue?

popy2k14 commented 4 years ago

Seems to be an python2/3 issue. Importing the modules takes long. I have removed all code from pylips.py and just leaved the imports in there, the delay with time on running the script is the same.

So it's not an pylips issue! Will go the mqtt way which is much faster on my first tests.

Closing this now.