opensearch-project / k-NN
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 885 units with 6,419 lines of code in units (60.7% of code).
    • 0 very long units (0 lines of code)
    • 9 long units (575 lines of code)
    • 40 medium size units (1,282 lines of code)
    • 87 small units (1,235 lines of code)
    • 749 very small units (3,327 lines of code)
0% | 8% | 19% | 19% | 51%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java0% | 9% | 16% | 17% | 56%
cpp0% | 8% | 41% | 19% | 29%
py0% | 0% | 22% | 35% | 41%
h0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/main/java/org0% | 9% | 16% | 17% | 56%
jni/src0% | 8% | 41% | 19% | 29%
benchmarks/perf-tool/okpt/io0% | 0% | 21% | 35% | 43%
benchmarks/perf-tool/okpt0% | 0% | 100% | 0% | 0%
benchmarks/perf-tool/okpt/diff0% | 0% | 0% | 54% | 45%
jni/include0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public Scorer scorer()
in src/main/java/org/opensearch/knn/index/KNNWeight.java
83 11 1
void knn_jni::nmslib_wrapper::CreateIndex()
in jni/src/nmslib_wrapper.cpp
77 15 6
public static ValidationException validateKnnField()
in src/main/java/org/opensearch/knn/index/IndexUtil.java
68 15 4
public static KNNMethodContext parse()
in src/main/java/org/opensearch/knn/index/KNNMethodContext.java
65 18 1
public void run()
in src/main/java/org/opensearch/knn/training/TrainingJob.java
65 8 0
private void putInternal()
in src/main/java/org/opensearch/knn/indices/ModelDao.java
58 8 3
protected void parseCreateField()
in src/main/java/org/opensearch/knn/index/KNNVectorFieldMapper.java
57 14 2
public void delete()
in src/main/java/org/opensearch/knn/indices/ModelDao.java
51 4 2
private TrainingModelRequest createTransportRequest()
in src/main/java/org/opensearch/knn/plugin/rest/RestTrainModelHandler.java
51 19 1
public void addKNNBinaryField()
in src/main/java/org/opensearch/knn/index/codec/KNN80Codec/KNN80DocValuesConsumer.java
49 7 2
void knn_jni::faiss_wrapper::CreateIndex()
in jni/src/faiss_wrapper.cpp
49 9 6
public static KNNQueryBuilder fromXContent()
in src/main/java/org/opensearch/knn/index/KNNQueryBuilder.java
47 12 1
public KNNVectorFieldMapper build()
in src/main/java/org/opensearch/knn/index/KNNVectorFieldMapper.java
45 6 1
45 7 5
def get_args()
in benchmarks/perf-tool/okpt/io/args.py
44 2 0
public void initialize()
in src/main/java/org/opensearch/knn/index/KNNCircuitBreaker.java
43 10 3
private void train()
in src/main/java/org/opensearch/knn/training/TrainingJobRunner.java
43 5 1
43 8 7
public static MethodComponentContext parse()
in src/main/java/org/opensearch/knn/index/MethodComponentContext.java
42 9 1
protected void doExecute()
in src/main/java/org/opensearch/knn/plugin/transport/TrainingModelTransportAction.java
40 2 3