D27504: WIP: RFC: smb faster copy to local

David Hallas noreply at phabricator.kde.org
Thu Feb 20 06:10:25 GMT 2020


hallas added inline comments.

INLINE COMMENTS

> anthonyfieroni wrote in kio_smb_dir.cpp:49
> Segment does not free its memory. Why not use QByteArray or similar with automatic storage allocation?

Yes, you could (and should ;) ) use standard C++ for this, i.e.:

  std::unique_ptr<char[]> buf;
  buf = std::make_unique<char{}>(segmentSize);

> kio_smb_dir.cpp:168
> +    std::condition_variable m_cond;
> +    Segment *m_buffer[4]; // should be at least 3 to give smbc some read ahead leeway
> +    const size_t m_capacity = 4;

Use standard C++ for this, i.e.:

  std::array<std::unique_ptr<Segment>, m_capacity> m_buffer;

This makes `m_buffer` iterable and it also ensures that the segments are always correctly freed.

> kio_smb_dir.cpp:494
> +    Buffer buffer(st.st_size);
> +    QFuture<int> future = QtConcurrent::run([&buffer, &srcfd]() -> int {
> +        while (true) {

What is the reason to use `QFuture` over `std::future`?

REPOSITORY
  R320 KIO Extras

REVISION DETAIL
  https://phabricator.kde.org/D27504

To: sitter, ngraham, cfeck
Cc: hallas, anthonyfieroni, asturmlechner, kde-frameworks-devel, kfm-devel, pberestov, iasensio, fprice, LeGast00n, cblack, MrPepe, fbampaloukas, alexde, GB_2, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20200220/a3dd523b/attachment.htm>


More information about the kfm-devel mailing list