andygrove commented on code in PR #1029: URL: https://github.com/apache/datafusion-comet/pull/1029#discussion_r1814310048
########## native/core/src/execution/jni_api.rs: ########## @@ -346,6 +347,10 @@ pub unsafe extern "system" fn Java_org_apache_comet_Native_executePlan( let exec_context_id = exec_context.id; + // We maintain a map of metrics name -> jstring object to reduce the overhead of calling + // jni_NewStringUTF repeatedly. + let mut metrics_jstrings: HashMap<String, Arc<GlobalRef>> = HashMap::new(); Review Comment: Rather than creating this hash map on each call to `executePlan`, could we create it during `createPlan` and store it in the `ExecutionContext`? This would allow us to allocate the strings once per plan rather than once per output batch. The resources would then be freed in `releasePlan`. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org