Skip to content

Doc improvement: Numpy is better than wsaccel? #687

@Arcitec

Description

@Arcitec

Hello! :-)

I was reading the docs at https://websocket-client.readthedocs.io/en/latest/faq.html#why-is-this-library-slow, and it explains that "please install both numpy and wsaccel, but note that wsaccel can sometimes cause other issues".

This message is way too vague and scared and intrigued me. So I checked the source code:

  • I see that wsaccel is used in https://github.com/websocket-client/websocket-client/blob/master/websocket/_utils.py and it's used for accelerating UTF8 correctness validation.
  • I see that both numpy and wsaccel are used in the ABNF library https://github.com/websocket-client/websocket-client/blob/master/websocket/_abnf.py, and that the code prefers numpy and ignores wsaccel if numpy was found.
  • As I understand it, the most "heavy" operation is the "mask" XOR stuff that WebSockets do, and which is very slow for big binary data. That's what numpy is the preferred accelerator for. So if I read this correctly, the most important speedup is to have numpy.
  • How important is wsaccel's acceleration of UTF-8 validation?
  • What are the "other issues" that wsaccel can cause? I have read every issue that mentions wsaccel, and all the docs. There's 1 mention in the docs about "other issues" and 1 mention in a ticket about "other issues" but never what "other issues" means.

I hope this discussion can help the community figure out what libraries to use. For now, I am going to assume that numpy is the best choice and will only install that, due to the vague "other issues" warning about wsaccel. ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions