pass.dispatchWorkgroups(1);
  pass.end();
  }

  encoder.copyBufferToBuffer(histogramBuffer, 0, resultBuffer, 0, resultBuffer.size);

  const commandBuffer = encoder.finish();
  device.queue.submit([commandBuffer]);

  timingHelper.getResult().then(duration => {
    console.log(`duration 1: ${duration}ns`);
  });
  timingHelper2.getResult().then(duration => {
    console.log(`duration 2: ${duration}ns`);
  });

  showImageBitmap(imgBitmap);

  await resultBuffer.mapAsync(GPUMapMode.READ);
  const result = n