2014-04-09 10 views
7

टिप्पणियां R धीमा करें?टिप्पणियां धीमी गति से आर करें?

यह सवाल अजगर के बारे में StackOverflow पर दो बार कहा गया है:

Do comments slow down an interpreted language? Will excessive commenting of code slow execution?

python के लिए इस सवाल का जवाब 'नहीं' प्रतीत होता है। मुझे दो भाषाओं के बीच मतभेदों के बारे में पर्याप्त जानकारी नहीं है यह जानने के लिए कि R के लिए ये उत्तर कितने प्रासंगिक हैं।

R में सफेद स्थान के बारे में एक समान प्रश्न है। फिर जवाब 'नो' प्रतीत होता है।

does white space slow down processing

उत्तर

4

आर के लिए इस सवाल का जवाब जब तक कि मैं कहीं नीचे एक गलती की होने के लिए 'हां', प्रकट होता है।

# Time difference of 21.84725 secs 
# Time difference of 24.05738 secs 

# total.time.2 - total.time.1 
# 
# Time difference of 2.210126 secs 

n <- 280 

start.time.1 <- Sys.time() 

b <- 2 

for(i in 1:n) { 
    for(j in 1:n) { 
      for(k in 1:n) { 

       b <- b + 2 - 1 - 0.75 

      } 
    } 
} 

b 

end.time.1 <- Sys.time() 

total.time.1 <- end.time.1 - start.time.1 
total.time.1 


start.time.2 <- Sys.time() 

b <- 2 

# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 


for(i in 1:n) { 

# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 

    for(j in 1:n) { 

# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 

      for(k in 1:n) { 

# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 

       b <- b + 2 - 1 - 0.75 

# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 
# I wonder whether comments slow down R. Here are some comments. Let's see. 

      } 
    } 
} 

b 

end.time.2 <- Sys.time() 

total.time.2 <- end.time.2 - start.time.2 

total.time.1 
total.time.2 

total.time.2 - total.time.1 
+1

हाँ, वास्तव में एक पैकेज बनाते समय उदाहरण के लिए, आर टिप्पणी की एक पंक्ति है कि (जैसे 'संकेत करने के लिए ls' दे रही है) सब comments.This को हटा कारण है कि मैं आर के अंदर एक समारोह कभी नहीं देखा है है। –

संबंधित मुद्दे