diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-01-15 23:33:27 +0200 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2022-01-16 02:01:23 +0200 |
commit | 8a879e205b9f336319572d181e5acf6c2fc31dfb (patch) | |
tree | 28739d7ee3d5161a860ae3fec0f2a5e772114598 /AK | |
parent | 309d71a66b63fe1390c0d0a2225a43813c40b73d (diff) | |
download | serenity-8a879e205b9f336319572d181e5acf6c2fc31dfb.zip |
AK: Mark the error branch of the TRY() macro as unlikely
This results in a measurable (and free!) 2% improvement in test-js
run time.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Try.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -9,12 +9,12 @@ // NOTE: This macro works with any result type that has the expected APIs. // It's designed with AK::Result and AK::Error in mind. -#define TRY(expression) \ - ({ \ - auto _temporary_result = (expression); \ - if (_temporary_result.is_error()) \ - return _temporary_result.release_error(); \ - _temporary_result.release_value(); \ +#define TRY(expression) \ + ({ \ + auto _temporary_result = (expression); \ + if (_temporary_result.is_error()) [[unlikely]] \ + return _temporary_result.release_error(); \ + _temporary_result.release_value(); \ }) #define MUST(expression) \ |