Created
          April 20, 2011 13:40 
        
      - 
      
 - 
        
Save tizoc/931350 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | erb_template = ERB.new(template_string) # Compiles template_string to ruby code that generates the output | |
| erb_template.result # Slow, calls eval on the compiled string every time you call render | |
| erb_proc = eval("Proc.new{#{erb_template.src}}") | |
| erb_proc.call # Fast, calls the code directly, no eval involved when generating the output | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment