[libc-commits] [PATCH] D128995: [libc][math] Improved ExhaustiveTest performance.

Kirill Okhotnikov via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jul 1 08:23:43 PDT 2022


orex added inline comments.


================
Comment at: libc/test/src/math/exhaustive/exhaustive_test.cpp:39-41
+          range_end = (stop - increment >= current_value)
+                          ? (current_value + increment)
+                          : stop;
----------------
lntue wrote:
> This might be overflow when `stop < increment`, since both are unsigned?
Agree. Thank you.


================
Comment at: libc/test/src/math/exhaustive/exhaustive_test.cpp:51
+          std::lock_guard<std::mutex> lock(mx_cout);
+          std::cout << new_percent << "% is in process     \r" << std::flush;
+        }
----------------
lntue wrote:
> It is actually convenient to display the tested range whether it passed or not, so that we can save time by only running the failed ranges again while developing.  Also if you build the message separately before passing all at once to `std::cout`, you will not need this lock, since a single `<<` for `std::cout` is guaranteed to be atomic.
That will be a lot of ranges, which is passed. I don't think it will be good to display them. Also you always have a values, which is not passed from testing macros, so you can use them to check problems. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128995/new/

https://reviews.llvm.org/D128995



More information about the libc-commits mailing list