java,同一个Runnable对象扔线程池多次和多个实例对象扔线程池有啥不同啊?

ExecutorService executor = Executors.newCachedThreadPool();
for (int i = 0; i < 10; i++) {
            executor.submit(new TaskRunnable());
}

ExecutorService executor = Executors.newCachedThreadPool();
TaskRunnable task = TaskRunnable()
for (int i = 0; i < 10; i++) {
     executor.submit(task);
}


今天调某个开放平台的接口发现有10倍左右的性能差异



你可能感兴趣的:(java,同一个Runnable对象扔线程池多次和多个实例对象扔线程池有啥不同啊?)