相关疑难解决方法(0)

为什么打印"B"比打印"#"要慢得多?

我生成了两个1000x 矩阵1000:

第一矩阵:O和#.
第二个矩阵:O和B.

使用以下代码,第一个矩阵需要8.52秒才能完成:

Random r = new Random();
for (int i = 0; i < 1000; i++) {
    for (int j = 0; j < 1000; j++) {
        if(r.nextInt(4) == 0) {
            System.out.print("O");
        } else {
            System.out.print("#");
        }
    }

   System.out.println("");
 }
Run Code Online (Sandbox Code Playgroud)

使用此代码,第二个矩阵需要259.152秒才能完成:

Random r = new Random();
for (int i = 0; i < 1000; i++) {
    for (int j = 0; j < 1000; j++) …
Run Code Online (Sandbox Code Playgroud)

java performance loops for-loop system.out

2662
推荐指数
3
解决办法
23万
查看次数

如何加速Cygwin?

我一直在我的相对较快的Windows机器上运行Cygwin的drush脚本(对于Drupal),但是我仍需要等待大约一分钟来执行任何drush命令(特别是drush cache clear执行).

我很确定它与Cygwin的速度有关,因为我的开发人员(运行Linux)可以在大约5秒内运行这些脚本.

有没有办法让Cygwin每个终端使用更多的内存和/或CPU?

bash cygwin drupal drush

19
推荐指数
3
解决办法
2万
查看次数

标签 统计

bash ×1

cygwin ×1

drupal ×1

drush ×1

for-loop ×1

java ×1

loops ×1

performance ×1

system.out ×1