This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 5edc9c614f Try to do less work in hot function HttpHookState::getNext
(#9660)
5edc9c614f is described below
commit 5edc9c614f9a54a624b5b0922329bedbe397cf73
Author: Chris McFarlen <[email protected]>
AuthorDate: Mon May 1 17:19:29 2023 -0500
Try to do less work in hot function HttpHookState::getNext (#9660)
* Try to do less work in hot function HttpHookState::getNext
* format
---------
Co-authored-by: Chris McFarlen <[email protected]>
(cherry picked from commit 1a01e9213588343aedfa2bb4d127294da57be175)
---
proxy/InkAPIInternal.h | 3 ---
src/traffic_server/InkAPI.cc | 37 ++++++++++++-------------------------
2 files changed, 12 insertions(+), 28 deletions(-)
diff --git a/proxy/InkAPIInternal.h b/proxy/InkAPIInternal.h
index 9cad0eb0f0..539972aac9 100644
--- a/proxy/InkAPIInternal.h
+++ b/proxy/InkAPIInternal.h
@@ -361,9 +361,6 @@ public:
/// Get the hook ID
TSHttpHookID id() const;
- /// Temporary function to return true. Later will be used to decide if a
plugin is enabled for the hooks
- bool is_enabled();
-
protected:
/// Track the state of one scope of hooks.
struct Scope {
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 1f46cdfdb9..d5bc38a3cd 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -1431,33 +1431,20 @@ APIHook const *
HttpHookState::getNext()
{
APIHook const *zret = nullptr;
- do {
- APIHook const *hg = _global.candidate();
- APIHook const *hssn = _ssn.candidate();
- APIHook const *htxn = _txn.candidate();
- zret = nullptr;
-
- Debug("plugin", "computing next callback for hook %d", _id);
-
- if (hg) {
- zret = hg;
- ++_global;
- } else if (hssn) {
- zret = hssn;
- ++_ssn;
- } else if (htxn) {
- zret = htxn;
- ++_txn;
- }
- } while (zret != nullptr && !this->is_enabled());
- return zret;
-}
+#ifdef DEBUG
+ Debug("plugin", "computing next callback for hook %d", _id);
+#endif
-bool
-HttpHookState::is_enabled()
-{
- return true;
+ if (zret = _global.candidate(); zret) {
+ ++_global;
+ } else if (zret = _ssn.candidate(); zret) {
+ ++_ssn;
+ } else if (zret = _txn.candidate(); zret) {
+ ++_txn;
+ }
+
+ return zret;
}
void