- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用的是 Dell Latitude E7440 笔记本电脑,配备 Windows 7 Enterprise 操作系统、8GB RAM、64 位操作系统、Intel(R) Core(TM) i7- 4600U CPU @ 2.10GHz 处理器,2701 Mhz,2 核,4 个逻辑处理器(即 4 核)。
我使用的是 Dell Precision Tower 7810 台式机,配备 Windows 7 Enterprise 操作系统、32GB RAM、64 位操作系统、Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz 2 处理器,2401 Mhz,6 核,12 个逻辑处理器(即 24 核)。
我对 R 的使用的一个很好的演示是在 RStudio 中使用 gbm
对具有约 300 个特征的 100K 大小的数据运行二进制分类。但无论我在笔记本电脑 R 版本上做什么(关闭所有其他软件,不使用并行化),都比我的桌面 R 版本快得多。怎么可能?我需要做什么才能找到答案?
笔记本电脑:
> sum <- 0; system.time(for (i in 1:1000000) sum <- sum + i)
user system elapsed
0.36 0.00 0.36
> memory.limit()
[1] 8097
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.1
桌面:
> sum <- 0; system.time(for (i in 1:1000000) sum <- sum + i)
user system elapsed
0.52 0.00 0.52
> memory.limit()
[1] 32684
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.1
最佳答案
Dell Latitude E7440 Laptop ... i7-4600U CPU @ 2.10GHz Processor, 2701 Mhz
Dell Precision Tower 7810 Desktop ... E5-2620 v3 @ 2.40GHz 2 Processors, 2401 Mhz
这就是原因。您的笔记本电脑的 CPU 的物理时钟速度比台式机的运行速度更快,因此 R 的运行速度也更快。
在没有多线程 BLAS 或其他并行处理技巧的情况下,拥有多个核心不会影响问题。同样,只要您有足够的内存来保存数据,更多 GB 不会加快速度(缓存问题除外,但 100K 应该可以轻松放入两台计算机上的缓存中)。
关于r - 为什么 R 在我的(较强的)台式机上比在我的(较弱的)笔记本电脑上慢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40258467/
我是一名优秀的程序员,十分优秀!