<div dir="auto">So, why don't we approach the console print out the same way as scheduling of scrollbar updates whereby the console function collects all the messages in the order they have been received and schedules a single print out so many times per second? That said, this in and out itself will still not solve the Twitter slowdown because in my case even a single post message after the console log gets excessively large will cause a slowdown which suggests that the process of printing it at the bottom of the console and possibly grouping it with previous identical messages may be too CPU intensive.<br><br><div data-smartmail="gmail_signature">Best,<br><br>Ico<br><br>-- <br>Ivica Ico Bukvic, D.M.A.<br>Director, Creativity + Innovation<br>Institute for Creativity, Arts, and Technology<br><br>Virginia Tech<br>Creative Technologies in Music<br>School of Performing Arts – 0141<br>Blacksburg, VA 24061<br>(540) 231-6139<br><a href="mailto:ico@vt.edu">ico@vt.edu</a><br><br><a href="http://www.icat.vt.edu">www.icat.vt.edu</a><br><a href="http://www.performingarts.vt.edu">www.performingarts.vt.edu</a><br><a href="http://l2ork.icat.vt.edu">l2ork.icat.vt.edu</a><br><a href="http://ico.bukvic.net">ico.bukvic.net</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 13, 2020, 14:00 Jonathan Wilkes <<a href="mailto:jon.w.wilkes@gmail.com">jon.w.wilkes@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Jun 13, 2020 at 9:06 AM Ivica Bukvic <<a href="mailto:ico@vt.edu" target="_blank" rel="noreferrer">ico@vt.edu</a>> wrote:<br>
><br>
> I don't think it is the number of messages sent at once (although if one sends thousands of lines in a single update it may have an adverse effect--i just haven't seen it being an issue even with larger dumps when the console log is short). During debugging, Tweeter can send several hundred in a single update.<br>
<br>
Check out DevTools-- you can record performance for a few seconds and<br>
it will give you a graph showing<br>
how often the GUI is doing a relayout.<br>
<br>
If you're calling print or post several hundred times then you're<br>
probably triggering a relayout each time. Collecting<br>
those into a documentFragment and doing a single DOM mutation will<br>
give a 100x or more efficient if that's the<br>
case.<br>
<br>
-Jonathan<br>
<br>
> This is, however, not a problem until you have long enough of the log. I suspect it is the process of searching through the log where to append the message and grouping the same ones that may be the culprit. Once you have several hundred messages in the queue, the slowdown becomes increasingly apparent even when you send a single line (this is the scenario I shared with you via the conference call). How cpu intensive is to group the same messages?<br>
><br>
> Best,<br>
><br>
> Ico<br>
><br>
> --<br>
> Ivica Ico Bukvic, D.M.A.<br>
> Director, Creativity + Innovation<br>
> Institute for Creativity, Arts, and Technology<br>
><br>
> Virginia Tech<br>
> Creative Technologies in Music<br>
> School of Performing Arts – 0141<br>
> Blacksburg, VA 24061<br>
> (540) 231-6139<br>
> <a href="mailto:ico@vt.edu" target="_blank" rel="noreferrer">ico@vt.edu</a><br>
><br>
> <a href="http://www.icat.vt.edu" rel="noreferrer noreferrer" target="_blank">www.icat.vt.edu</a><br>
> <a href="http://www.performingarts.vt.edu" rel="noreferrer noreferrer" target="_blank">www.performingarts.vt.edu</a><br>
> <a href="http://l2ork.icat.vt.edu" rel="noreferrer noreferrer" target="_blank">l2ork.icat.vt.edu</a><br>
> <a href="http://ico.bukvic.net" rel="noreferrer noreferrer" target="_blank">ico.bukvic.net</a><br>
><br>
> On Sat, Jun 13, 2020, 01:16 Jonathan Wilkes <<a href="mailto:jon.w.wilkes@gmail.com" target="_blank" rel="noreferrer">jon.w.wilkes@gmail.com</a>> wrote:<br>
>><br>
>> On Fri, Jun 12, 2020 at 10:29 PM Ivica Bukvic <<a href="mailto:ico@vt.edu" target="_blank" rel="noreferrer">ico@vt.edu</a>> wrote:<br>
>> ><br>
>> > Another way I'm reading this is that this may be more reminiscent of what I've done in the 1.x branch where the console is running essentially in a separate TK thread to ensure that it does not have any bearing on the visual updates of the main thread. It reads from a queue which is being populated by the main thread, so that the console has no direct impact on the main thread. That said, this backgrounded process seems to be a bit different than what the TK has and may need to be investigated further.<br>
>><br>
>> Just curious-- in your l2ork tweeter demo of this problem, how often<br>
>> were you sending messages to the Pd Window?<br>
>><br>
>> -Jonathan<br>
>><br>
>> ><br>
>> > Best,<br>
>> ><br>
>> > Ico<br>
>> ><br>
>> > --<br>
>> > Ivica Ico Bukvic, D.M.A.<br>
>> > Director, Creativity + Innovation<br>
>> > Institute for Creativity, Arts, and Technology<br>
>> ><br>
>> > Virginia Tech<br>
>> > Creative Technologies in Music<br>
>> > School of Performing Arts – 0141<br>
>> > Blacksburg, VA 24061<br>
>> > (540) 231-6139<br>
>> > <a href="mailto:ico@vt.edu" target="_blank" rel="noreferrer">ico@vt.edu</a><br>
>> ><br>
>> > <a href="http://www.icat.vt.edu" rel="noreferrer noreferrer" target="_blank">www.icat.vt.edu</a><br>
>> > <a href="http://www.performingarts.vt.edu" rel="noreferrer noreferrer" target="_blank">www.performingarts.vt.edu</a><br>
>> > <a href="http://l2ork.icat.vt.edu" rel="noreferrer noreferrer" target="_blank">l2ork.icat.vt.edu</a><br>
>> > <a href="http://ico.bukvic.net" rel="noreferrer noreferrer" target="_blank">ico.bukvic.net</a><br>
>> ><br>
>> > On Fri, Jun 12, 2020, 22:25 Jonathan Wilkes <<a href="mailto:jon.w.wilkes@gmail.com" target="_blank" rel="noreferrer">jon.w.wilkes@gmail.com</a>> wrote:<br>
>> >><br>
>> >> On Fri, Jun 12, 2020 at 7:47 PM Ivica Bukvic <<a href="mailto:ico@vt.edu" target="_blank" rel="noreferrer">ico@vt.edu</a>> wrote:<br>
>> >> ><br>
>> >> > This may be a way how to avoid console output bogging down the main GUI. Namely, running it in a background.<br>
>> >> ><br>
>> >> > <a href="https://blog.logrocket.com/node-js-multithreading-what-are-worker-threads-and-why-do-they-matter-48ab102f8b10/" rel="noreferrer noreferrer" target="_blank">https://blog.logrocket.com/node-js-multithreading-what-are-worker-threads-and-why-do-they-matter-48ab102f8b10/</a><br>
>> >><br>
>> >> It looks like we've run into this before given the presence of<br>
>> >> throttle_console_scroll in pdgui.js. But that was just due<br>
>> >> to the slowness of the scrollbar itself.<br>
>> >><br>
>> >> Probably an easier solution than a worker thread is to batch appending<br>
>> >> new stuff to the console when necessary:<br>
>> >><br>
>> >> 1. when a message to the console arrives, print it immediately and set<br>
>> >> a timeout, say 30ms<br>
>> >> 2. during the timeout period, add incoming console messages to a<br>
>> >> documentFragment<br>
>> >> 3. at the end of the timeout, if there's content inside the<br>
>> >> documentFragment then append it to the console and start a new<br>
>> >> timeout. If there's no content then do nothing.<br>
>> >><br>
>> >> That way if a user is thrashing the console, they only eat the cost of<br>
>> >> rendering at most every 30ms.<br>
>> >><br>
>> >> -Jonathan<br>
>> >><br>
>> >> ><br>
>> >> > Best,<br>
>> >> ><br>
>> >> > Ico<br>
>> >> ><br>
>> >> > --<br>
>> >> > Ivica Ico Bukvic, D.M.A.<br>
>> >> > Director, Creativity + Innovation<br>
>> >> > Institute for Creativity, Arts, and Technology<br>
>> >> ><br>
>> >> > Virginia Tech<br>
>> >> > Creative Technologies in Music<br>
>> >> > School of Performing Arts – 0141<br>
>> >> > Blacksburg, VA 24061<br>
>> >> > (540) 231-6139<br>
>> >> > <a href="mailto:ico@vt.edu" target="_blank" rel="noreferrer">ico@vt.edu</a><br>
>> >> ><br>
>> >> > <a href="http://www.icat.vt.edu" rel="noreferrer noreferrer" target="_blank">www.icat.vt.edu</a><br>
>> >> > <a href="http://www.performingarts.vt.edu" rel="noreferrer noreferrer" target="_blank">www.performingarts.vt.edu</a><br>
>> >> > <a href="http://l2ork.icat.vt.edu" rel="noreferrer noreferrer" target="_blank">l2ork.icat.vt.edu</a><br>
>> >> > <a href="http://ico.bukvic.net" rel="noreferrer noreferrer" target="_blank">ico.bukvic.net</a><br>
>> >> > _______________________________________________<br>
>> >> > L2Ork-dev mailing list<br>
>> >> > <a href="mailto:L2Ork-dev@disis.music.vt.edu" target="_blank" rel="noreferrer">L2Ork-dev@disis.music.vt.edu</a><br>
>> >> > <a href="https://disis.music.vt.edu/listinfo/l2ork-dev" rel="noreferrer noreferrer" target="_blank">https://disis.music.vt.edu/listinfo/l2ork-dev</a><br>
>> >> _______________________________________________<br>
>> >> L2Ork-dev mailing list<br>
>> >> <a href="mailto:L2Ork-dev@disis.music.vt.edu" target="_blank" rel="noreferrer">L2Ork-dev@disis.music.vt.edu</a><br>
>> >> <a href="https://disis.music.vt.edu/listinfo/l2ork-dev" rel="noreferrer noreferrer" target="_blank">https://disis.music.vt.edu/listinfo/l2ork-dev</a><br>
>> ><br>
>> > _______________________________________________<br>
>> > L2Ork-dev mailing list<br>
>> > <a href="mailto:L2Ork-dev@disis.music.vt.edu" target="_blank" rel="noreferrer">L2Ork-dev@disis.music.vt.edu</a><br>
>> > <a href="https://disis.music.vt.edu/listinfo/l2ork-dev" rel="noreferrer noreferrer" target="_blank">https://disis.music.vt.edu/listinfo/l2ork-dev</a><br>
>> _______________________________________________<br>
>> L2Ork-dev mailing list<br>
>> <a href="mailto:L2Ork-dev@disis.music.vt.edu" target="_blank" rel="noreferrer">L2Ork-dev@disis.music.vt.edu</a><br>
>> <a href="https://disis.music.vt.edu/listinfo/l2ork-dev" rel="noreferrer noreferrer" target="_blank">https://disis.music.vt.edu/listinfo/l2ork-dev</a><br>
><br>
> _______________________________________________<br>
> L2Ork-dev mailing list<br>
> <a href="mailto:L2Ork-dev@disis.music.vt.edu" target="_blank" rel="noreferrer">L2Ork-dev@disis.music.vt.edu</a><br>
> <a href="https://disis.music.vt.edu/listinfo/l2ork-dev" rel="noreferrer noreferrer" target="_blank">https://disis.music.vt.edu/listinfo/l2ork-dev</a><br>
_______________________________________________<br>
L2Ork-dev mailing list<br>
<a href="mailto:L2Ork-dev@disis.music.vt.edu" target="_blank" rel="noreferrer">L2Ork-dev@disis.music.vt.edu</a><br>
<a href="https://disis.music.vt.edu/listinfo/l2ork-dev" rel="noreferrer noreferrer" target="_blank">https://disis.music.vt.edu/listinfo/l2ork-dev</a></blockquote></div>