pytorch
a66625da - [PyTorch] Optimize DictType::annotation_str_impl (#96498)

Commit
1 year ago
[PyTorch] Optimize DictType::annotation_str_impl (#96498) stringstream construction is expensive, and we can exactly reserve space for the output string while doing the same number of string copies. (If we wanted to improve performance further, we could introduce annotation_str_out to append the output to a given std::string and thus avoid copying subtype annotation strings. It occurs to me that the existing approach is quadratic in the number of layers of nesting, so we should probably do this!) Differential Revision: [D43919651](https://our.internmc.facebook.com/intern/diff/D43919651/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/96498 Approved by: https://github.com/Skylion007
Author
Committer
Parents
Loading