Skip to main content
QUICK REVIEW

[Paper Review] SourcererCC and SourcererCC-I: Tools to Detect Clones in Batch mode and During Software Development

Vaibhav Saini, Hitesh Sajnani|arXiv (Cornell University)|Mar 5, 2016
Software Engineering ResearchComputer Science24 references24 citations
TL;DR

SourcererCC is a scalable, token-based clone detection tool that uses an optimized inverted index and token-ordering heuristics to efficiently detect Type 1–3 clones in large codebases using a standard workstation. SourcererCC-I is an Eclipse plug-in that enables real-time, incremental clone detection during software development, achieving high performance and accuracy without requiring distributed infrastructure.

ABSTRACT

Given the availability of large source-code repositories, there has been a large number of applications for large-scale clone detection. Unfortunately, despite a decade of active research, there is a marked lack in clone detectors that scale to big software systems or large repositories, specifically for detecting near-miss (Type 3) clones where significant editing activities may take place in the cloned code. This paper demonstrates: (i) SourcererCC, a token-based clone detector that targets the first three clone types, and exploits an index to achieve scalability to large inter-project repositories using a standard workstation. It uses an optimized inverted-index to quickly query the potential clones of a given code block. Filtering heuristics based on token ordering are used to significantly reduce the size of the index, the number of code-block comparisons needed to detect the clones, as well as the number of required token-comparisons needed to judge a potential clone, and (ii) SourcererCC-I, an Eclipse plug-in, that uses SourcererCC's core engine to identify and navigate clones (both inter and intra project) in real-time during software development. In our experiments, comparing SourcererCC with the state-of-the-art tools, we found that it is the only clone detection tool to successfully scale to 250 MLOC on a standard workstation with 12 GB RAM and efficiently detect the first three types of clones (precision 86% and recall 86-100%). Link to the demo: https://youtu.be/l7F_9Qp-ks4

Motivation & Objective

  • Address the lack of scalable, accurate clone detectors that support near-miss (Type 3) clones in large software systems.
  • Enable efficient clone detection in both batch mode and during active software development without requiring distributed computing.
  • Provide a programming language-agnostic solution that works on inter-project and intra-project codebases with minimal resource usage.
  • Support real-time clone detection in IDEs to assist developers during active coding, improving maintainability and reducing duplication risks.
  • Achieve high precision and recall for Type 1–3 clones while maintaining performance on large repositories using only a standard workstation.

Proposed method

  • Constructs a partial inverted index using a Sub-block Overlap Filtering heuristic to index only a subset of tokens per code block, reducing index size and query cost.
  • Employs Token Position Filtering to compute dynamic upper- and lower-bounds on similarity scores using token order, enabling early rejection or acceptance of candidate clones.
  • Uses a token-based approach with language-aware tokenization (currently for Java, C, C#) to support multiple programming languages without requiring AST parsing.
  • Integrates the core SourcererCC engine into an Eclipse plug-in (SourcererCC-I) for real-time clone detection during development.
  • Supports incremental index updates, allowing fast re-indexing after code changes without full reprocessing.
  • Groups detected clones hierarchically by project and file, enabling intuitive navigation in the IDE.

Experimental results

Research questions

  • RQ1Can a token-based clone detector achieve high scalability to 250MLOC on a standard workstation while supporting Type 3 (near-miss) clones?
  • RQ2Can filtering heuristics based on token ordering significantly reduce the number of required token comparisons and index size without sacrificing recall?
  • RQ3Can real-time clone detection be efficiently integrated into an IDE without degrading performance or development workflow?
  • RQ4Can a non-distributed, language-agnostic tool outperform existing batch tools in both scalability and usability during active development?
  • RQ5Is it possible to maintain high precision and recall for clone detection across large inter-project repositories using a single-machine deployment?

Key findings

  • SourcererCC is the only tool among Deckard, CCFinder, NiCad, and iClones to successfully scale to 250 million lines of code (MLOC) on a standard workstation with 12 GB RAM.
  • SourcererCC achieves 86% precision and 86–100% recall for the first three clone types, outperforming state-of-the-art tools in both accuracy and scalability.
  • The filtering heuristics reduce the number of code-block comparisons and token-comparisons needed, significantly improving performance.
  • SourcererCC-I enables real-time clone detection with index creation taking only a few milliseconds per 100,000 lines of code.
  • The incremental index update mechanism ensures fast response after code changes, making it practical for ongoing development.
  • SourcererCC-I supports both intra-project and inter-project clone detection and presents results in a hierarchical, navigable tree structure in the Eclipse IDE.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.