Both methods call self.with_segments() unconditionally. This can be skipped if the other argument is already an instance of PurePath, and no further (deprecated) positional arguments are given.
Also, relative_to() can inline the core of the is_relative_to() check to avoid the type/deprecated args checks.
Linked PRs