eye-gu commented on code in PR #7582:
URL: https://github.com/apache/shenyu/pull/7582#discussion_r4271049332
##########
shenyu-plugin/shenyu-plugin-wasm-api/src/main/java/org/apache/shenyu/plugin/wasm/api/loader/WasmLoader.java:
##########
@@ -282,17 +369,62 @@ private Optional<ExportFunction> findWasmExtern(final
String funcName) {
return Optional.of(instance.export(funcName));
}
}
- LOG.debug("WASM export function '{}' not found in {}", funcName,
wasmName);
return Optional.empty();
}
-
+
+ private long[] executeOnPool(final String funcName, final long[] args) {
+ final Instance lease = acquire();
+ try {
+ return executeBound(lease, lease.export(funcName), args);
+ } finally {
+ release(lease);
+ }
+ }
Review Comment:
Checked against Chicory 1.7.3 sources: Instance.export(name) is a single
export-section lookup plus a small lambda allocation — negligible next to the
guest execution and surrounding request I/O it precedes. Since pooled instances
rotate per call, caching would require a per-(funcName, instance) map, adding
pool state for a nanosecond-scale win. Skipping until a profiler shows this
matters.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]