mirror of
				https://github.com/larstvei/dot-emacs.git
				synced 2025-11-04 01:20:11 +00:00 
			
		
		
		
	Init optimization
This commit is contained in:
		
							parent
							
								
									5e05a6b373
								
							
						
					
					
						commit
						74ba7de172
					
				
							
								
								
									
										10
									
								
								init.org
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								init.org
									
									
									
									
									
								
							@ -135,6 +135,16 @@
 | 
				
			|||||||
          (load-file private-file))
 | 
					          (load-file private-file))
 | 
				
			||||||
        (server-start))))
 | 
					        (server-start))))
 | 
				
			||||||
   #+END_SRC
 | 
					   #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   A common optimization is to temporarily disable garbage collection during
 | 
				
			||||||
 | 
					   initialization. Here, we set the ~gc-cons-threshold~ to a ridiculously large
 | 
				
			||||||
 | 
					   number, and restore the default value after initialization.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   #+BEGIN_SRC emacs-lisp
 | 
				
			||||||
 | 
					   (lexical-let ((old-gc-treshold gc-cons-threshold))
 | 
				
			||||||
 | 
					     (setq gc-cons-threshold most-positive-fixnum)
 | 
				
			||||||
 | 
					     (add-hook 'after-init-hook
 | 
				
			||||||
 | 
					               (lambda () (setq gc-cons-threshold old-gc-treshold))))
 | 
				
			||||||
   #+END_SRC
 | 
					   #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Packages
 | 
					** Packages
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user