summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-15 23:33:27 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2022-01-16 02:01:23 +0200
commit8a879e205b9f336319572d181e5acf6c2fc31dfb (patch)
tree28739d7ee3d5161a860ae3fec0f2a5e772114598 /AK
parent309d71a66b63fe1390c0d0a2225a43813c40b73d (diff)
downloadserenity-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.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/AK/Try.h b/AK/Try.h
index 8db09a950a..b1364125e8 100644
--- a/AK/Try.h
+++ b/AK/Try.h
@@ -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) \