[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Review Request 114276: KateDocument->closeUrl speedup
From:       "Dominik Haumann" <dhaumann () kde ! org>
Date:       2013-12-03 22:43:17
Message-ID: 20131203224317.22231.39762 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Dec. 3, 2013, 8:09 p.m., Milian Wolff wrote:
> > Well, the document did change its url - no? You can close a document and open \
> > another file in it after all. 
> > What you might want is an "about to delete/shutdown" kind of flag in which case \
> > this might be a valid optimization. 
> > Then again, 500 files in Kate? Are you seriously doing this?
> 
> Michal Humpula wrote:
> Can you please give me specific example of the opening new file in document? \
> Closest thing I could think off is when doing saveAs, but it turns out the \
> implementation in Document is calling ReadWritePart::saveAs, which doesn't call \
> closeUrl at all. 
> Personaly don't like those flags, imho they increase coupling.
> 
> That big session, not me. But I can imagine easily getting to 100 if you are \
> working on a project and simply don't close your files and keep them in the \
> session. 
> Dominik Haumann wrote:
> In fact, it can happen to have so many files open: If you have a huge project, and \
> you use the Search&Replace plugin to replace text in many files, all these file \
> will be opened. 
> Generally, I very much welcome this patch and such optimizations. However, I cannot \
> say anything about the side-effects in may cause. This is a signal on Kate Part \
> level, maybe Kile/KDevelop or other apps rely on it? - Hard to say for me. 
> That said, we could commit this to master, so it will end up in 4.13. If we want to \
> stay safe, we also could just commit this to the frameworks branch so it will end \
> up in KDE 5. 
> Michal Humpula wrote:
> Did a little bit of search. Seems like the only other use of closeUrl (except for \
> actually closing the document) is in openUrl (the same goes for KateDocument and \
> for ReadWritePart), which closes the document before loading the new one. In which \
> case it emit the notifications about name change anyway (and with the patch above \
> emits only once trough the whole process). 
> So even when the user would want to call closeUrl and use the same object to open \
> new url in it (imho bad idea), the signal of name to be changed would be emited by \
> the openUrl call. In other words, why update window title and several other things, \
> when <100ms later the document will have again new name (valid this time). 
> Milian Wolff wrote:
> Well, I of course agree that this should not be emitted when the document gets \
> deleted afterwards anyways. So if you can make sure there are no downsides to this \
> then go for it. 
> Just please also add documentation that this won't work as expected then:
> 
> KateDocument doc;
> doc.openUrl(...);
> // no doc change here.
> doc.closeUrl();
> 
> Apparently noone uses that, but Kate e.g. could use it instead of closing + delete \
> all documents and creating a new one - it could simply closeUrl the last and delete \
> the others. Then you safe the allocations of it and its owned data. But probably \
> that is not worth it, and the optimization you see in Kate is much more important. 
> @Dominik: I'd rather have it in kate master, so we can test it accordingly and not \
> be bitten by strange bugs once we start to use KF5.

For instance, Kate uses this, if I understand & remember correctly: If there is only \
one document and you close this document, it's just closed but not deleted. So yes, \
in this case, the url as well as the name changes.

What Milian says sounds very sane: If the document is deleted anyways, notifying \
about a name change to "untitled" or so does not make much sense.

So what does all this mean for this request for now?

Btw, there is a review request from me about opening an url and reusing an untitled \
document: https://git.reviewboard.kde.org/r/112187/ This case leads to different code \
paths, and therefore reading session information or similar does not work correctly \
in this case. I'm not sure whether this is related to this review request, probably \
not.


- Dominik


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/114276/#review45052
-----------------------------------------------------------


On Dec. 3, 2013, 4:26 p.m., Michal Humpula wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/114276/
> -----------------------------------------------------------
> 
> (Updated Dec. 3, 2013, 4:26 p.m.)
> 
> 
> Review request for Kate.
> 
> 
> Repository: kate
> 
> 
> Description
> -------
> 
> Is it really necesary to `updateDocName` when we just finished closing the document \
> (and destroying all its highlits, marks, ...)? 
> Testing environment: openned session of size 500 files; *.cpp an *.h files from \
> kate src tree, nothing is dirty. The "New Session" takes 23 seconds. Half of that \
> time is spent in KateFileTree plugin (computating colors) called from document name \
> updating. 
> All the tests are passing. So is there any scenario, where this patch would yield \
> wrong behaviour, e.g. can client call closeUrl and expect document still work as if \
> nothing happened? 
> 
> Diffs
> -----
> 
> part/document/katedocument.cpp dad52bb 
> 
> Diff: http://git.reviewboard.kde.org/r/114276/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michal Humpula
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/114276/">http://git.reviewboard.kde.org/r/114276/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On December 3rd, 2013, 8:09 p.m. UTC, <b>Milian \
Wolff</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Well, the document did change its url - no? You can close a document and \
open another file in it after all.

What you might want is an &quot;about to delete/shutdown&quot; kind of flag in which \
case this might be a valid optimization.

Then again, 500 files in Kate? Are you seriously doing this?</pre>
 </blockquote>




 <p>On December 3rd, 2013, 8:29 p.m. UTC, <b>Michal Humpula</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Can you please give me \
specific example of the opening new file in document? Closest thing I could think off \
is when doing saveAs, but it turns out the implementation in Document is calling \
ReadWritePart::saveAs, which doesn&#39;t call closeUrl at all.

Personaly don&#39;t like those flags, imho they increase coupling.

That big session, not me. But I can imagine easily getting to 100 if you are working \
on a project and simply don&#39;t close your files and keep them in the \
session.</pre>  </blockquote>





 <p>On December 3rd, 2013, 8:44 p.m. UTC, <b>Dominik Haumann</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">In fact, it can happen \
to have so many files open: If you have a huge project, and you use the \
Search&amp;Replace plugin to replace text in many files, all these file will be \
opened.

Generally, I very much welcome this patch and such optimizations. However, I cannot \
say anything about the side-effects in may cause. This is a signal on Kate Part \
level, maybe Kile/KDevelop or other apps rely on it? - Hard to say for me.

That said, we could commit this to master, so it will end up in 4.13. If we want to \
stay safe, we also could just commit this to the frameworks branch so it will end up \
in KDE 5.</pre>  </blockquote>





 <p>On December 3rd, 2013, 9:03 p.m. UTC, <b>Michal Humpula</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Did a little bit of \
search. Seems like the only other use of closeUrl (except for actually closing the \
document) is in openUrl (the same goes for KateDocument and for ReadWritePart), which \
closes the document before loading the new one. In which case it emit the \
notifications about name change anyway (and with the patch above emits only once \
trough the whole process).

So even when the user would want to call closeUrl and use the same object to open new \
url in it (imho bad idea), the signal of name to be changed would be emited by the \
openUrl call. In other words, why update window title and several other things, when \
&lt;100ms later the document will have again new name (valid this time).</pre>  \
</blockquote>





 <p>On December 3rd, 2013, 10:35 p.m. UTC, <b>Milian Wolff</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well, I of course agree \
that this should not be emitted when the document gets deleted afterwards anyways. So \
if you can make sure there are no downsides to this then go for it.

Just please also add documentation that this won&#39;t work as expected then:

KateDocument doc;
doc.openUrl(...);
// no doc change here.
doc.closeUrl();

Apparently noone uses that, but Kate e.g. could use it instead of closing + delete \
all documents and creating a new one - it could simply closeUrl the last and delete \
the others. Then you safe the allocations of it and its owned data. But probably that \
is not worth it, and the optimization you see in Kate is much more important.

@Dominik: I&#39;d rather have it in kate master, so we can test it accordingly and \
not be bitten by strange bugs once we start to use KF5.</pre>  </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">For instance, Kate uses \
this, if I understand &amp; remember correctly: If there is only one document and you \
close this document, it&#39;s just closed but not deleted. So yes, in this case, the \
url as well as the name changes.

What Milian says sounds very sane: If the document is deleted anyways, notifying \
about a name change to &quot;untitled&quot; or so does not make much sense.

So what does all this mean for this request for now?

Btw, there is a review request from me about opening an url and reusing an untitled \
document: https://git.reviewboard.kde.org/r/112187/ This case leads to different code \
paths, and therefore reading session information or similar does not work correctly \
in this case. I&#39;m not sure whether this is related to this review request, \
probably not.</pre> <br />










<p>- Dominik</p>


<br />
<p>On December 3rd, 2013, 4:26 p.m. UTC, Michal Humpula wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Kate.</div>
<div>By Michal Humpula.</div>


<p style="color: grey;"><i>Updated Dec. 3, 2013, 4:26 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kate
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Is it really necesary to `updateDocName` when we just finished closing \
the document (and destroying all its highlits, marks, ...)?

Testing environment: openned session of size 500 files; *.cpp an *.h files from kate \
src tree, nothing is dirty. The &quot;New Session&quot; takes 23 seconds. Half of \
that time is spent in KateFileTree plugin (computating colors) called from document \
name updating.

All the tests are passing. So is there any scenario, where this patch would yield \
wrong behaviour, e.g. can client call closeUrl and expect document still work as if \
nothing happened?</pre>  </td>
 </tr>
</table>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>part/document/katedocument.cpp <span style="color: grey">(dad52bb)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/114276/diff/" style="margin-left: \
3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic