public double benchmark(int iterations, int vectorSize, List<Tensor> modelVectors, TensorType.Dimension.Type dimensionType,
                            boolean extraSpace, boolean stringLabels) {
        Tensor queryVector = vectors(1, vectorSize, dimensionType, stringLabels).get(0);
        if (extraSpace) {
            queryVector = queryVector.multiply(unitVector("j"));
            modelVectors = modelVectors.stream().map(t -> t.multiply(unitVector("k"))).toList();
        }
        dotProduct(queryVector, modelVectors, Math.max(iterations / 10, 10)); // warmup
        System.gc();
        long startTime = System.currentTimeMillis();
        dotProduct(queryVector, modelVectors, iterations);
        long totalTime = System.currentTimeMillis() - startTime;
        return (double) totalTime / (double) iterations;
    }
Microbenchmark of tensor operations.

@author bratseth
vespajlib/src/test/java/com/yahoo/tensor/TensorFunctionBenchmark.java