|
|
Chromium Code Reviews
DescriptionPerformance optimizations for base/numerics absolute value and multiply
Removes a number of branches from the calculations. Also now exporting
SafeUnsignedAbs as a public API.
NOTRY=true
Committed: https://crrev.com/ba3c4f9491c6bbff71f109c508f5a6b9297fe67a
Cr-Commit-Position: refs/heads/master@{#437769}
Patch Set 1 #Patch Set 2 : cleanup #Patch Set 3 : more shuffling #
Total comments: 4
Patch Set 4 : nits #Patch Set 5 : one more nit #
Total comments: 1
Messages
Total messages: 29 (15 generated)
jschuh@chromium.org changed reviewers: + scottmg@chromium.org
ptal
Description was changed from ========== Remove several branches from base/numerics absolute value and multiply These paths had never previously been optimized for performance. ========== to ========== Performance optimizations for base/numerics absolute value and multiply Removes a number of branches from the calculations. Also now exporting SafeUnsignedAbs as a public API. ==========
Patchset #3 (id:40001) has been deleted
Patchset #3 (id:60001) has been deleted
Patchset #3 (id:80001) has been deleted
Apparently VS will do an (a^mask)-mask already https://www.strchr.com/optimized_abs_function, but I guess you found some don't? https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... File base/numerics/safe_conversions_impl.h (right): https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... base/numerics/safe_conversions_impl.h:47: // This wrapper undoes the standard integer promotions. I don't see this getting used?
> Apparently VS will do an (a^mask)-mask already > https://www.strchr.com/optimized_abs_function, but I guess you found some don't? Can't read the link, but std::abs is not reliably constexpr, and I was also getting some compiler warnings/errors when it compile-time evaluated things like INT_MAX. Since it's a small bit of code, I just implemented it directly. https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... File base/numerics/safe_conversions_impl.h (right): https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... base/numerics/safe_conversions_impl.h:47: // This wrapper undoes the standard integer promotions. On 2016/12/09 22:48:24, scottmg wrote: > I don't see this getting used? It is in safe_math_impl.h. I just moved it because it felt weird to leave it hanging out alone there.
https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... File base/numerics/safe_conversions_impl.h (right): https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... base/numerics/safe_conversions_impl.h:55: typename std::enable_if<!std::is_signed<T>::value>::type* = nullptr> std::is_integral<T>::value && in the enable_if for consistency with where it's used.
https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... File base/numerics/safe_conversions_impl.h (right): https://codereview.chromium.org/2566733002/diff/100001/base/numerics/safe_con... base/numerics/safe_conversions_impl.h:55: typename std::enable_if<!std::is_signed<T>::value>::type* = nullptr> On 2016/12/09 23:27:02, scottmg wrote: > std::is_integral<T>::value && > > in the enable_if for consistency with where it's used. I had that originally, but there are no unsigned non-integral types. Also, this is an internal function called from only one place, so the specialization here was just a sanity check rather than a requirement.
whew. Yeah, OK, I think I convinced myself. lgtm.
The CQ bit was checked by jschuh@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from scottmg@chromium.org Link to the patchset: https://codereview.chromium.org/2566733002/#ps2 (title: "one more nit")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2566733002/diff/2/base/numerics/safe_math_impl.h File base/numerics/safe_math_impl.h (right): https://codereview.chromium.org/2566733002/diff/2/base/numerics/safe_math_imp... base/numerics/safe_math_impl.h:188: *result = static_cast<T>((uresult ^ -is_negative) + is_negative); I would have moved that before this line instead, if anywhere, since that's where it's used.
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by jschuh@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Description was changed from ========== Performance optimizations for base/numerics absolute value and multiply Removes a number of branches from the calculations. Also now exporting SafeUnsignedAbs as a public API. ========== to ========== Performance optimizations for base/numerics absolute value and multiply Removes a number of branches from the calculations. Also now exporting SafeUnsignedAbs as a public API. NOTRY=true ==========
The CQ bit was checked by jschuh@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 2, "attempt_start_ts": 1481378451838640, "parent_rev":
"efc63d3d65dad987fadaaed5cf8d6960a6239a8d", "commit_rev":
"f194232799e0d4de3ca4f36ba28b5a3fd7a093a1"}
Message was sent while issue was closed.
Description was changed from ========== Performance optimizations for base/numerics absolute value and multiply Removes a number of branches from the calculations. Also now exporting SafeUnsignedAbs as a public API. NOTRY=true ========== to ========== Performance optimizations for base/numerics absolute value and multiply Removes a number of branches from the calculations. Also now exporting SafeUnsignedAbs as a public API. NOTRY=true Review-Url: https://codereview.chromium.org/2566733002 ==========
Message was sent while issue was closed.
Committed patchset #5 (id:2)
Message was sent while issue was closed.
Description was changed from ========== Performance optimizations for base/numerics absolute value and multiply Removes a number of branches from the calculations. Also now exporting SafeUnsignedAbs as a public API. NOTRY=true Review-Url: https://codereview.chromium.org/2566733002 ========== to ========== Performance optimizations for base/numerics absolute value and multiply Removes a number of branches from the calculations. Also now exporting SafeUnsignedAbs as a public API. NOTRY=true Committed: https://crrev.com/ba3c4f9491c6bbff71f109c508f5a6b9297fe67a Cr-Commit-Position: refs/heads/master@{#437769} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/ba3c4f9491c6bbff71f109c508f5a6b9297fe67a Cr-Commit-Position: refs/heads/master@{#437769} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
