<https://godbolt.org/z/95dnchnb3>

Why do these produce different assembly?  
these all mean the same thing, discard the result...  

    
    
    # test1
    # 154 lines of assembly
    
    proc test: int =
      echo "wow"
      10
    
    var _ = test()
    var _ = test()
    
    
    Run
    
    
    # test2
    # 152 lines of assembly
    
    proc test: int =
      echo "wow"
      10
    
    discard test()
    discard test()
    
    
    Run
    
    
    # test3
    # 116 lines of assembly
    
    proc test: int =
      echo "wow"
      10
    
    var _ {.global.} = test()
    var _ {.global.} = test()
    
    
    Run

Reply via email to