Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not generate error messages in TRY_CAST and TRY(CAST) (facebookinc…
…ubator#9900) Summary: Pull Request resolved: facebookincubator#9900 Generating error messages and carrying them around is quite expensive. Since we don't use error messages in TRY_CAST or TRY(CAST) we can avoid generating them altogether. Doing so improves performance up to 3x. Introduce thread-local flag to indicate whether no-throw APIs need to provide detailed error message. Use this flag to avoid generating error messages in CAST. try_cast_invalid_nan benchmark improved 3x: Before: ``` ============================================================================ [...]hmarks/ExpressionBenchmarkBuilder.cpp relative time/iter iters/s ============================================================================ cast##try_cast_invalid_empty_input 2.21ms 452.57 cast##tryexpr_cast_invalid_empty_input 24.23ms 41.27 cast##try_cast_invalid_nan 16.95ms 59.00 cast##tryexpr_cast_invalid_nan 42.26ms 23.66 ---------------------------------------------------------------------------- ``` After: ``` ============================================================================ [...]hmarks/ExpressionBenchmarkBuilder.cpp relative time/iter iters/s ============================================================================ cast##try_cast_invalid_empty_input 2.41ms 415.65 cast##tryexpr_cast_invalid_empty_input 24.90ms 40.16 cast##try_cast_invalid_nan 5.76ms 173.52 cast##tryexpr_cast_invalid_nan 27.75ms 36.03 ``` Reviewed By: xiaoxmeng, Yuhta Differential Revision: D57700900 fbshipit-source-id: c95b293986f2f293a33e199725ca5c50c84e415e
- Loading branch information