projjal commented on a change in pull request #11193:
URL: https://github.com/apache/arrow/pull/11193#discussion_r713936262



##########
File path: cpp/src/gandiva/llvm_generator.h
##########
@@ -49,10 +51,48 @@ class GANDIVA_EXPORT LLVMGenerator {
   static Status Make(std::shared_ptr<Configuration> config,
                      std::unique_ptr<LLVMGenerator>* llvm_generator);
 
+  static std::shared_ptr<Cache<BaseCacheKey, 
std::shared_ptr<llvm::MemoryBuffer>>>
+  GetCache();
+
   /// \brief Build the code for the expression trees for default mode. Each
   /// element in the vector represents an expression tree
   Status Build(const ExpressionVector& exprs, SelectionVector::Mode mode);
 
+  /// \brief Build the code for the expression trees for default mode with a 
LLVM
+  /// ObjectCache. Each element in the vector represents an expression tree
+  template <class KeyType>
+  Status Build(const ExpressionVector& exprs, SelectionVector::Mode mode,
+               GandivaObjectCache<KeyType>& obj_cache) {
+    selection_vector_mode_ = mode;
+
+    // Start measuring code gen time
+    auto begin = std::chrono::high_resolution_clock::now();
+    for (auto& expr : exprs) {
+      auto output = annotator_.AddOutputFieldDescriptor(expr->result());
+      ARROW_RETURN_NOT_OK(Add(expr, output));
+    }
+
+    // Stop measuring time, calculate the elapsed time and pass it to object 
cache
+    auto end = std::chrono::high_resolution_clock::now();
+    size_t elapsed =

Review comment:
       You can track the time inside the gandivaObjectCache; start timer in 
constructor and stop it in notifyObject method?
   Also, its best not to knowingly proceed with incorrect solution if you are 
stuck somewhere. 




-- 
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...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to