unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* redisplay - very long lines
@ 2009-02-16 13:44 David Reitter
  2009-02-16 19:27 ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: David Reitter @ 2009-02-16 13:44 UTC (permalink / raw)
  To: Emacs-Devel devel

The redisplay code seems to be unable to deal efficiently with very  
long lines, that is, lines that go beyond the currently displayed  
window.

This was pointed out by a blogger who wanted to abuse Emacs to make a  
quick change to a binary file.  I could reproduce the problem using a  
17MB binary file, which loaded and displayed fine initially.  I then  
removed all newlines from the file, upon which redisplay gets  
unbearably slow (minutes to redisplay once).

Setting truncate-lines makes things faster, but not to the point where  
one could work.

This is in version 22 and 23.  The profiler output (Shark) is below.   
Would it be possible to add a termination condition in move_it_to to  
stop after leaving the window vertically or horizontally (with  
truncate-lines)?  Or simply use a large enough threshold?



	0.0%	99.8%	Emacs	start	
	0.0%	99.8%	Emacs	 main	
	0.0%	99.8%	Emacs	  Frecursive_edit	
	0.0%	99.8%	Emacs	   recursive_edit_1	
	0.0%	99.8%	Emacs	    command_loop	
	0.0%	99.8%	Emacs	     internal_catch	
	0.0%	99.8%	Emacs	      command_loop_2	
	0.0%	99.8%	Emacs	       internal_condition_case	
	0.0%	99.8%	Emacs	        command_loop_1	
	0.0%	99.8%	Emacs	         call3	
	0.0%	99.8%	Emacs	          Ffuncall	
	0.0%	99.8%	Emacs	           Fcall_interactively	
	0.0%	99.8%	Emacs	            apply1	
	0.0%	99.8%	Emacs	             Fapply	
	0.0%	99.8%	Emacs	              Ffuncall	
	0.0%	99.8%	Emacs	               funcall_lambda	
	0.0%	99.8%	Emacs	                Fbyte_code	
	0.0%	99.8%	Emacs	                 Ffuncall	
	0.0%	99.8%	Emacs	                  funcall_lambda	
	0.0%	99.8%	Emacs	                   Fbyte_code	
	0.0%	99.8%	Emacs	                    Ffuncall	
	0.0%	99.8%	Emacs	                     funcall_lambda	
	0.0%	99.8%	Emacs	                      Fbyte_code	
	0.0%	99.8%	Emacs	                       Ffuncall	
	0.0%	99.8%	Emacs	                        Freplace_match	
	0.0%	99.8%	Emacs	                         replace_range	
	0.0%	99.8%	Emacs	                          signal_after_change	
	0.0%	99.8%	Emacs	                           run_hook_with_args	
	0.0%	99.8%	Emacs	                            Ffuncall	
	0.0%	99.8%	Emacs	                             Fgarbage_collect	
	0.0%	99.8%	Emacs	                              truncate_undo_list	
	0.0%	99.8%	Emacs	                               call1	
	0.0%	99.8%	Emacs	                                Ffuncall	
	0.0%	99.8%	Emacs	                                 funcall_lambda	
	0.0%	99.8%	Emacs	                                  Fbyte_code	
	0.0%	99.8%	Emacs	                                   Ffuncall	
	0.0%	99.8%	Emacs	                                    funcall_lambda	
	0.0%	99.8%	Emacs	                                     Fbyte_code	
	0.0%	99.8%	Emacs	                                      Ffuncall	
	0.0%	99.8%	Emacs	                                       funcall_lambda	
	0.0%	99.8%	Emacs	                                        Fbyte_code	
	0.0%	99.8%	Emacs	                                         Ffuncall	
	0.0%	99.8%	Emacs	                                          Fredisplay	
	0.0%	99.8%	Emacs	                                            
redisplay_preserve_echo_area	
	0.0%	99.8%	Emacs	                                             
redisplay_internal	
	0.0%	99.8%	Emacs	                                              
redisplay_windows	
	0.0%	99.8%	Emacs	                                               
redisplay_windows	
	0.0%	99.8%	Emacs	                                                
internal_condition_case_1	
	0.0%	99.8%	Emacs	                                                 
redisplay_window_0	
	0.0%	99.8%	Emacs	                                                  
redisplay_window	
	0.0%	99.8%	Emacs	                                                   
move_it_vertically_backward	
	0.0%	62.3%	Emacs	                                                    
move_it_to	
	8.9%	62.0%	Emacs	                                                     
move_it_in_display_line_to	
	14.2%	30.5%	 
Emacs	                                                      
x_produce_glyphs	
	2.1%	9.3%	Emacs	                                                       
get_per_char_metric	
	7.1%	7.1%	 
Emacs	                                                        
nsfont_text_extents	
	3.3%	6.5%	Emacs	                                                       
get_char_face_and_encoding	
	0.5%	0.5%	Emacs	                                                       
take_vertical_position_into_account	
	0.1%	0.1%	Emacs	                                                       
nsfont_text_extents	
	8.3%	17.5%	Emacs	                                                      
get_next_display_element	
	3.5%	4.4%	Emacs	                                                      
set_iterator_to_next	
	0.4%	0.4%	Emacs	                                                      
next_element_from_display_vector	
	0.1%	0.1%	Emacs	                                                      
next_element_from_buffer	
	0.1%	0.1%	Emacs	                                                      
get_char_face_and_encoding	
	0.0%	0.0%	Emacs	                                                      
char_table_ref	
	0.1%	0.1%	Emacs	                                                     
set_iterator_to_next	
	0.1%	0.1%	Emacs	                                                     
x_produce_glyphs	
	0.1%	0.1%	Emacs	                                                     
get_next_display_element	
	0.0%	0.0%	Emacs	                                                     
recenter_overlay_lists	
	0.0%	37.3%	Emacs	                                                    
move_it_by_lines	
	0.0%	0.1%	Emacs	                                                    
back_to_previous_visible_line_start	
	0.0%	0.0%	Emacs	                                                    
line_bottom_y	
	0.0%	0.0%	Emacs	                                                   
try_window	
	0.0%	0.0%	Emacs	                                                   
move_it_by_lines	
	0.0%	0.0%	Emacs	                                              
prepare_menu_bars	
	0.1%	0.1%	mach_kernel	lo_alltraps	
	0.0%	0.0%	mach_kernel	i386_astintr	
	0.0%	0.0%	mach_kernel	lo_unix_scall	
	0.0%	0.0%	mach_kernel	IOWorkLoop::threadMain()	
	0.0%	0.0%	mach_kernel	thread_continue	
	0.0%	0.0%	mach_kernel	ml_set_interrupts_enabled	
	0.0%	0.0%	mach_kernel	lo_mach_scall	





^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: redisplay - very long lines
@ 2009-02-17 17:16 grischka
  2009-02-17 19:37 ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: grischka @ 2009-02-17 17:16 UTC (permalink / raw)
  To: eliz; +Cc: emacs-devel

> > Would it be possible to add a termination condition in move_it_to to
> > stop after leaving the window vertically or horizontally (with
> > truncate-lines)?
>
> If we can tolerate an incorrect display, maybe.  The invisible part of
> the line could in principle include characters and faces whose
> presence may have global effects on the rest of the displayed portion,
> such as faces that use larger fonts, to say nothing of inline images.

That is not a necessary consequence at all.

After all faces and images don't come fallen from outer space into
the text but if they exist then it was the emacs program itself that
has put them there.  So instead of scanning lines each time it could
as well just remember where and how big they are.





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2009-02-19 16:30 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-16 13:44 redisplay - very long lines David Reitter
2009-02-16 19:27 ` Eli Zaretskii
2009-02-16 23:02   ` David Reitter
2009-02-17  4:16     ` Eli Zaretskii
2009-02-17 13:40       ` Stefan Monnier
2009-02-17 19:41         ` Eli Zaretskii
2009-02-17 21:21           ` David Reitter
2009-02-18  4:09             ` Eli Zaretskii
2009-02-18  4:50               ` David Reitter
2009-02-18 18:47                 ` Eli Zaretskii
2009-02-18 19:44                   ` Stefan Monnier
2009-02-18 19:50                     ` David Reitter
2009-02-18  2:26           ` Stefan Monnier
2009-02-18  4:17             ` Eli Zaretskii
2009-02-18  4:56               ` Stefan Monnier
2009-02-18 18:46                 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2009-02-17 17:16 grischka
2009-02-17 19:37 ` Eli Zaretskii
2009-02-18 20:41   ` grischka
2009-02-19  4:15     ` Eli Zaretskii
2009-02-19 16:30       ` grischka

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