请评论减慢R?

请评论减慢R

这个问题已经在StackOverflow上关于python两次提出:

评论是否会减慢解释型语言? 代码的过度评论会减慢执行速度吗?

对于python ,答案似乎是“否”。 我对这两种语言之间的差异了解不多,不知道这些答案与R有多相关。

这里是关于R空白的类似问题。 答案似乎是'不'。

白色空间减慢处理


对于R来说,答案似乎是'是',除非我在下面的某个地方犯了错误。

# 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
链接地址: http://www.djcxy.com/p/78585.html

上一篇: Do comments slow down R?

下一篇: Grails vs Spring performance for REST