4 Commits
Author SHA1 Message Date
Aaron Gokaslan 75eef9d885 [BE][Ez]: Use rvalue overload for stringstream str (#186552)
CPP20 introduced an rvalue overload to stringstream.str() . Without it, the string is copied out for the str() call every time. Now, we can steal the internal string buffer and return it directly through the rvalue overload. Mechanical find and replace assisted by codex.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/186552
Approved by: https://github.com/malfet
2026-06-08 00:09:08 +00:00
Aaron Gokaslan a29983011f [BE][Ez]: Micro-opt char literal ostream overloads (#186387)
A lot of streams append single characters without going through the char level overload. This requires them to calculate and reserve length on it and go through less efficient string and `<<` overloads.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/186387
Approved by: https://github.com/malfet, https://github.com/cyyever
2026-06-06 03:00:51 +00:00
Nikita Shulga 81d765ef1f Fix sign-compare violations in cpp tests
Prerequisite change for enabling `-Werror=sign-compare` across PyTorch repo

Pull Request resolved: https://github.com/pytorch/pytorch/pull/75080

Approved by: https://github.com/atalman
2022-04-04 23:05:31 +00:00
Laurence Rouesnel 3bdee2bbed [jit] Rewrote DFS graph iterator to remove unnecessary local state (#61326) (#61980)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/61980

Test Plan: Imported from OSS

Reviewed By: mruberry

Differential Revision: D29917766

Pulled By: laurencer

fbshipit-source-id: 536c4806636fe9e709e8bffdefa9320127064dea
2021-07-27 11:50:20 -07:00