Defer XML string cleaning to improve performance by eliasbenb · Pull Request #1511 · pushingkarmaorg/python-plexapi

Description

This PR optimizes XML parsing by deferring the use of utils.cleanXMLString, which contains an expensive regex query. Instead of always cleaning the string before parsing, we now attempt to parse the XML string in its raw form, only falling back to cleaning if a ParseError occurs.

Originally suggested in #1510 (comment).

Type of change

None of the types of changes really apply, this is a performance enhancement

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods
  • I have added tests when applicable