我一直在优化射线追踪器,为了提高速度,我使用了OpenMP,大致如下(C++):
Accelerator accelerator; // Has the data to make tracing way faster
Rays rays; // Makes the rays so they're ready to go
#pragma omp parallel for
for (int y = 0; y < window->height; y++) {
for (int x = 0; x < window->width;
我正在基准测试总延迟转换为来自Object的数据类型。但是我遇到了一个非常奇怪的Java集合行为,在这个例子中,是一个List。
List<Long> data = new ArrayList<>();
int SIZE = 50_000_000;
long currentTime = System.currentTimeMillis();
for (int i = 0; i < SIZE; i++) {
data.add(currentTime++);
}
在运行上述代码时,在我的、Intel、i5、8250 u (4核)上运行的CPU利用率为100%