aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/eval/fast_value.h
blob: 33595da0c3dab33c09379922026065cfe35306ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "value_builder_factory.h"

namespace vespalib::eval {

/**
 * A fast value is a value that uses a FastValueIndex to store its
 * sparse mappings. The FastValueIndex class contains inlined
 * functions that can be called directly from instruction
 * implementations to speed up sparse operations. Also, the
 * FastSparseMap used by the FastValueIndex is a highly optimized
 * alternative to the map used by SimpleValue, which means that normal
 * Value API usage will also have improved performance.
 **/
class FastValueBuilderFactory : public ValueBuilderFactory {
private:
    FastValueBuilderFactory();
    static FastValueBuilderFactory _factory;
    std::unique_ptr<ValueBuilderBase> create_value_builder_base(const ValueType &type, bool transient,
            size_t num_mapped_dims, size_t subspace_size, size_t expected_subspaces) const override;
public:
    static const FastValueBuilderFactory &get() { return _factory; }
};

}