opensearch-project / k-NN
Duplication

Places in code with 6 or more lines that are exactly the same.

Intro
  • For duplication, we look at places in code where there are 6 or more lines of code that are exactly the same.
  • Before duplication is calculated, the code is cleaned to remove empty lines, comments, and frequently duplicated constructs such as imports.
  • You should aim at having as little as possible (<5%) of duplicated code as high-level of duplication can lead to maintenance difficulties, poor factoring, and logical contradictions.
Learn more...
Duplication Overall
  • 7% duplication:
    • 7,318 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 538 duplicated lines
  • 46 duplicates
system7% (538 lines)
Duplication per Extension
java6% (396 lines)
cpp8% (63 lines)
yml37% (44 lines)
py7% (35 lines)
Duplication per Component (primary)
src/main/java/org6% (396 lines)
jni/src8% (63 lines)
benchmarks/perf-tool/okpt/io8% (35 lines)
benchmarks/perf-tool/sample-configs/faiss-sift-ivf36% (22 lines)
benchmarks/perf-tool/sample-configs/nmslib-sift-hnsw61% (22 lines)
src/main/plugin-metadata0% (0 lines)
jni/include0% (0 lines)
jni0% (0 lines)
benchmarks/perf-tool0% (0 lines)
benchmarks/perf-tool/okpt0% (0 lines)
benchmarks/perf-tool/okpt/diff0% (0 lines)
Longest Duplicates
The list of 20 longest duplicates.
See data for all 46 duplicates...
Size#FoldersFilesLinesCode
34 x 2 src/main/java/org/opense.../index/codec/KNN86Codec
src/main/java/org/opense.../index/codec/KNN87Codec
KNN86Codec.java
KNN87Codec.java
65:126 (60%)
65:126 (60%)
view
30 x 2 src/main/java/org/opense.../index/codec/KNN80Codec
src/main/java/org/opense.../index/codec/KNN84Codec
KNN80Codec.java
KNN84Codec.java
60:113 (58%)
64:117 (58%)
view
24 x 2 src/main/java/org/opense.../index/codec/KNN84Codec
src/main/java/org/opense.../index/codec/KNN87Codec
KNN84Codec.java
KNN87Codec.java
80:117 (47%)
89:126 (42%)
view
24 x 2 src/main/java/org/opense.../index/codec/KNN80Codec
src/main/java/org/opense.../index/codec/KNN87Codec
KNN80Codec.java
KNN87Codec.java
76:113 (47%)
89:126 (42%)
view
24 x 2 src/main/java/org/opense.../index/codec/KNN84Codec
src/main/java/org/opense.../index/codec/KNN86Codec
KNN84Codec.java
KNN86Codec.java
80:117 (47%)
89:126 (42%)
view
24 x 2 src/main/java/org/opense.../index/codec/KNN80Codec
src/main/java/org/opense.../index/codec/KNN86Codec
KNN80Codec.java
KNN86Codec.java
76:113 (47%)
89:126 (42%)
view
22 x 2 benchmarks/perf-tool/sample-configs/faiss-sift-ivf
benchmarks/perf-tool/sam...onfigs/nmslib-sift-hnsw
test.yml
test.yml
35:56 (36%)
13:34 (61%)
view
15 x 2 src/main/java/org/opensearch/knn/index/memory
src/main/java/org/opensearch/knn/index/memory
NativeMemoryAllocation.java
NativeMemoryAllocation.java
157:184 (7%)
414:436 (7%)
view
10 x 2 src/main/java/org/opensearch/knn/index
src/main/java/org/opensearch/knn/index
KNNMethodContext.java
MethodComponentContext.java
199:211 (9%)
102:114 (10%)
view
10 x 2 jni/src
jni/src
faiss_wrapper.cpp
nmslib_wrapper.cpp
39:59 (5%)
31:50 (7%)
view
10 x 2 src/main/java/org/opensearch/knn/index
src/main/java/org/opensearch/knn/index
MethodComponent.java
MethodComponent.java
137:154 (8%)
198:214 (8%)
view
9 x 2 src/main/java/org/opensearch/knn/plugin/rest
src/main/java/org/opensearch/knn/plugin/rest
RestGetModelHandler.java
RestSearchModelHandler.java
37:47 (40%)
61:71 (20%)
view
8 x 2 src/main/java/org/opensearch/knn/plugin/rest
src/main/java/org/opensearch/knn/plugin/rest
RestDeleteModelHandler.java
RestGetModelHandler.java
39:48 (38%)
37:46 (36%)
view
8 x 2 jni/src
jni/src
faiss_wrapper.cpp
faiss_wrapper.cpp
84:94 (4%)
268:278 (4%)
view
8 x 2 src/main/java/org/opensearch/knn/plugin/rest
src/main/java/org/opensearch/knn/plugin/rest
RestSearchModelHandler.java
RestTrainModelHandler.java
61:70 (18%)
51:60 (9%)
view
8 x 2 src/main/java/org/opensearch/knn/index/memory
src/main/java/org/opensearch/knn/index/memory
NativeMemoryAllocation.java
NativeMemoryAllocation.java
142:158 (4%)
281:296 (4%)
view
8 x 2 src/main/java/org/opense.../index/codec/KNN80Codec
src/main/java/org/opense.../index/codec/KNN86Codec
KNN80Codec.java
KNN86Codec.java
41:54 (15%)
46:59 (14%)
view
8 x 2 src/main/java/org/opensearch/knn/plugin/transport
src/main/java/org/opensearch/knn/plugin/transport
RemoveModelFromCacheNodeRequest.java
RemoveModelFromCacheRequest.java
44:60 (57%)
45:61 (57%)
view
8 x 2 src/main/java/org/opensearch/knn/plugin/rest
src/main/java/org/opensearch/knn/plugin/rest
RestDeleteModelHandler.java
RestTrainModelHandler.java
39:48 (38%)
51:60 (9%)
view
8 x 2 src/main/java/org/opense.../index/codec/KNN84Codec
src/main/java/org/opense.../index/codec/KNN86Codec
KNN84Codec.java
KNN86Codec.java
45:58 (15%)
46:59 (14%)
view
Duplicated Units
The list of top 2 duplicated units.
See data for all 2 unit duplicates...
Size#FoldersFilesLinesCode
7 x 2 jni/src
jni/src
jni_util.cpp
jni_util.cpp
300:309 
311:320 
view
6 x 2 src/main/java/org/opensearch/knn/index/memory
src/main/java/org/opensearch/knn/index/memory
NativeMemoryAllocation.java
NativeMemoryAllocation.java
119:125 
250:256 
view