You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/08/12 12:36:09 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #869: MINIFICPP-1328 - Improve performance of FileStream

szaszm commented on a change in pull request #869:
URL: https://github.com/apache/nifi-minifi-cpp/pull/869#discussion_r469225255



##########
File path: libminifi/src/io/FileStream.cpp
##########
@@ -101,13 +96,12 @@ int FileStream::writeData(std::vector<uint8_t> &buf, int buflen) {
 
 int FileStream::writeData(uint8_t *value, int size) {
   if (!IsNullOrEmpty(value)) {
-    std::lock_guard<std::recursive_mutex> lock(file_lock_);
+    std::lock_guard<std::mutex> lock(file_lock_);
     if (file_stream_->write(reinterpret_cast<const char*>(value), size)) {
       offset_ += size;
       if (offset_ > length_) {
         length_ = offset_;
       }
-      file_stream_->seekg(offset_);

Review comment:
       This seeks the input position indicator after write has automatically seeked the output indicator. Yes, they are separate, and no, I don't find this intuitive either.
   https://godbolt.org/z/oe1M4j

##########
File path: libminifi/src/core/ProcessSession.cpp
##########
@@ -261,10 +261,9 @@ void ProcessSession::write(const std::shared_ptr<core::FlowFile> &flow, OutputSt
     flow->setResourceClaim(claim);
 
     stream->closeStream();
-    std::stringstream details;
-    details << process_context_->getProcessorNode()->getName() << " modify flow record content " << flow->getUUIDStr();
+    std::string details = process_context_->getProcessorNode()->getName() + " modify flow record content " + flow->getUUIDStr();

Review comment:
       `StringUtils::join_pack` could further improve performance by performing only one allocation for the join.




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

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