インスピレーションはstackoverflowの投稿でした。 その結果、次のソリューションが得られました。
return preg_replace('/( 
      
        
        
        
      
     "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" # match double quoted string 
      
        
        
        
      
     | 
      
        
        
        
      
     \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' # match single quoted string 
      
        
        
        
      
     | 
      
        
        
        
      
     (?s:\\/\\*.*?\\*\\/) # multiline comments 
      
        
        
        
      
     | 
      
        
        
        
      
     \\/\\/.*?\\n # singleline comments 
      
        
        
        
      
     | 
      
        
        
        
      
     string.replace\\(\\/[^\\/\\\\]*(?:\\\\.[^\\/\\\\]*)*\\/ # an JS regexp 
      
        
        
        
      
     )/x', '', $str); 
      
        
        
        
      
    
      
      そして、これはアナライザーよりも何倍も速く、そのうち50行が忘却に沈んでいます。