felipecrv commented on code in PR #38443:
URL: https://github.com/apache/arrow/pull/38443#discussion_r1408551084


##########
cpp/src/arrow/c/bridge.cc:
##########
@@ -260,7 +264,7 @@ struct SchemaExporter {
       // Dictionary type: parent struct describes index type,
       // child dictionary struct describes value type.
       RETURN_NOT_OK(VisitTypeInline(*dict_type.index_type(), this));
-      dict_exporter_.reset(new SchemaExporter());
+      dict_exporter_ = std::make_unique<SchemaExporter>();

Review Comment:
   In scenarios where you have an `std::unique_ptr<ParentClass>` being 
populated by many sub-classes of `ParentClass`:
   
   `std::make_unique<T, Deleter>(...)` can lead to more binary bloat because 
`class Deleter = std::default_delete<T>` is type-specialized whereas `reset()` 
takes a super-class pointer and only needs the deleter that invokes the 
destructor via dynamic dispatching through the parent class vtable.
   
   Being type-specialized often leads to the derived-classes destructors' being 
inlined into the `std::default_deleter<T>`. All this extra inlining and removal 
of one indirection could lead to less overhead of destructor dispatching.



-- 
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]

Reply via email to