unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Mauger <mmaug@yahoo.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Vitalie Spinu <spinuvit@gmail.com>, Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Deffering redisplay in COMINT
Date: Fri, 11 Jan 2013 06:40:24 -0800 (PST)	[thread overview]
Message-ID: <1357915224.58763.YahooMailNeo@web160903.mail.bf1.yahoo.com> (raw)
In-Reply-To: <jwvlic35yqr.fsf-monnier+emacs@gnu.org>


>>  The pre hook only activates if the mode is enabled and truncate-lines
>>  is set.  When active, it disables auto-hscroll-mode.  It then appends 
>>  the output text to a temporary buffer and then returns a window's
>>  width worth of characters of each line in the temp buffer to 
>>  be written to the output buffer.  The output appears to fill each 
>>  line without the display slowdown due to long displayed lines.
>>  And because hscroll is turned off, the text merely flows up the
>>  screen quickly.
> 
> Have you tried the (presumably) simpler approach of only inserting the
> text one line at a time, i.e. accumulate the output in some undisplayed
> "buffer area" (can be a buffer, a string, or a list of strings, this
> last choice being probably the most efficient) until you see a \n and
> then insert that text (upto and including the \n, so the cursor stays in
> column 0 and doesn't risk triggering auto-hscroll-mode) while keeping
> the rest in the "buffer area"?
> 
> 
>         Stefan
> 

I hate that after beating my head against the wall for a month, you can
say "Have you tried..." and I'm sitting here going "Duh!".  ;-)  Thanks.

You are correct that by only passing along the incoming text thru 
(and including) the last newline of the preoutput text does reduce the 
auto-hscroll-mode related flickering.  The trick is detecting the prompt
at the end of the output to force the filter to flush everything.  The 
implementation is very straightforward just using a string to hold
what is left over from the prior iteration.  

Comparing the results to not having the filter, is dramatic.  I have a 
query that produces about 200 rows of data x 8000 characters per 
row (the database columns are waaaay too long for the data present, 
but that's what I have to live with).  Without the filter and 
auto-hscroll-mode engaged, the results take nearly 30 seconds to 
complete under Emacs.  (It is nearly instantaneous outside of Emacs.)  
With the filter you suggest, the results take about 8-10 seconds with 
a noticeable stutter between each row.  With the solution I had 
developed (buffering the long lines in a buffer and restoring them at 
the end of output), the results scroll by quickly in about 2-3 seconds, 
but then it hesitates at the end (as it restores the long lines in the 
buffer), for another 2-3 seconds.  So just reducing the horizontal 
scrolling is giving us the big payback and the more complex 
gymnastics is probably not worth code cost.

Thank you again, Stefan.  Thanks for the suggestion and clarifying my
thinking about how process output and display is handled in Emacs.  
Your leadership and patience is appreciated.  

I'll be adding this filtering to an existing output filter in sql.el.  

-- Michael



  reply	other threads:[~2013-01-11 14:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-07  1:08 Deffering redisplay in COMINT Michael Mauger
2012-12-25 11:09 ` Vitalie Spinu
2013-01-06  8:09   ` Michael Mauger
2013-01-08 18:19     ` Stefan Monnier
2013-01-11 14:40       ` Michael Mauger [this message]
2013-01-11 15:55         ` Stefan Monnier
2013-01-13  8:14           ` Michael Mauger
2013-01-13 16:46             ` Eli Zaretskii
2013-01-16 14:39             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357915224.58763.YahooMailNeo@web160903.mail.bf1.yahoo.com \
    --to=mmaug@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=spinuvit@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).