Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused &block argument #1776

Closed

Commits on Jul 5, 2018

  1. Remove unused &block

    Removing unused &block argument will prevent creating unnecessary proc.
    
    Example:
    
    Script:
    	xml_file = "test/files/staff.xml"
    	xml = Nokogiri::XML(File.read(xml_file), xml_file)
    	employees = xml.search("//employee")
    	MemoryProfiler.report{ employees.collect{|emp| emp.children.collect{|e| e.name}} }.pretty_print
    
    Master:
    
    Total allocated: 5280 bytes (93 objects)
    Total retained:  0 bytes (0 objects)
    
    allocated memory by class
    -----------------------------------
          2600  String
          1400  Array
           960  Proc
           320  Nokogiri::XML::NodeSet
    
    allocated objects by class
    -----------------------------------
            65  String
            12  Proc
            11  Array
             5  Nokogiri::XML::NodeSet
    
    
    After Changes:
    
    Total allocated: 4320 bytes (81 objects)
    Total retained:  0 bytes (0 objects)
    
    allocated memory by class
    -----------------------------------
          2600  String
          1400  Array
           320  Nokogiri::XML::NodeSet
    
    allocated objects by class
    -----------------------------------
            65  String
            11  Array
             5  Nokogiri::XML::NodeSet
    chopraanmol1 committed Jul 5, 2018
    Copy the full SHA
    1f5ab74 View commit details
    Browse the repository at this point in the history