File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed 
lib/mix/lib/mix/compilers Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -373,8 +373,7 @@ defmodule Mix.Compilers.Elixir do
373373            Map . has_key? ( stale_modules ,  module )  -> 
374374              { [ module  |  modules_to_recompile ] ,  modules_to_mix_check } 
375375
376-             recompile?  and  Code . ensure_loaded? ( module )  and 
377-                 function_exported? ( module ,  :__mix_recompile__? ,  0 )  -> 
376+             recompile?  -> 
378377              { modules_to_recompile ,  [ module  |  modules_to_mix_check ] } 
379378
380379            true  -> 
@@ -385,7 +384,17 @@ defmodule Mix.Compilers.Elixir do
385384    modules_to_recompile  = 
386385      modules_to_recompile  ++ 
387386        for  { :ok ,  { module ,  true } }  <- 
388-               Task . async_stream ( modules_to_mix_check ,  & { & 1 ,  & 1 . __mix_recompile__? ( ) } , 
387+               Task . async_stream ( 
388+                 modules_to_mix_check , 
389+                 fn  mod  -> 
390+                   # Since loading the modules themselves can be expensive, 
391+                   # we want to do it inside the task too. Modules being deleted 
392+                   # are uncommon, so this optimizes the common case. 
393+                   { mod , 
394+                    Code . ensure_loaded? ( mod )  and 
395+                      function_exported? ( mod ,  :__mix_recompile__? ,  0 )  and 
396+                      mod . __mix_recompile__? ( ) } 
397+                 end , 
389398                ordered:  false , 
390399                timeout:  :infinity 
391400              )  do 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments