[{"data":1,"prerenderedAt":395},["ShallowReactive",2],{"navigation_docs":3,"-project-benchmarks-ai-token-efficiency":239,"-project-benchmarks-ai-token-efficiency-surround":390},[4,29,94,114,184],{"title":5,"icon":6,"path":7,"stem":8,"children":9},"Start",false,"\u002Fstart","1.start",[10,14,19,24],{"title":11,"path":7,"stem":12,"icon":13},"What jscpd finds","1.start\u002Findex","i-lucide-house",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fstart\u002Finstallation","1.start\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quickstart","\u002Fstart\u002Fquickstart","1.start\u002F3.quickstart","i-lucide-rocket",{"title":25,"path":26,"stem":27,"icon":28},"Configuration basics","\u002Fstart\u002Fconfiguration","1.start\u002F4.configuration","i-lucide-settings-2",{"title":30,"icon":6,"path":31,"stem":32,"children":33,"page":6},"Guides","\u002Fguides","2.guides",[34,39,44,49,54,59,64,69,74,79,84,89],{"title":35,"path":36,"stem":37,"icon":38},"Use jscpd in CI","\u002Fguides\u002Fci","2.guides\u002F01.ci","i-lucide-github",{"title":40,"path":41,"stem":42,"icon":43},"Pre-commit hooks","\u002Fguides\u002Fpre-commit","2.guides\u002F02.pre-commit","i-lucide-git-commit",{"title":45,"path":46,"stem":47,"icon":48},"Fail only on new duplication","\u002Fguides\u002Fbaseline","2.guides\u002F03.baseline","i-lucide-git-compare",{"title":50,"path":51,"stem":52,"icon":53},"Monorepos","\u002Fguides\u002Fmonorepos","2.guides\u002F04.monorepos","i-lucide-folder-tree",{"title":55,"path":56,"stem":57,"icon":58},"Cross-format detection","\u002Fguides\u002Fcross-format","2.guides\u002F05.cross-format","i-lucide-layers",{"title":60,"path":61,"stem":62,"icon":63},"Agents","\u002Fguides\u002Fagents","2.guides\u002F06.agents","i-lucide-cpu",{"title":65,"path":66,"stem":67,"icon":68},"Editors","\u002Fguides\u002Feditors","2.guides\u002F07.editors","i-lucide-code",{"title":70,"path":71,"stem":72,"icon":73},"Duplication over git history","\u002Fguides\u002Fhistory","2.guides\u002F08.history","i-lucide-chart-no-axes-combined",{"title":75,"path":76,"stem":77,"icon":78},"Dashboard and health score","\u002Fguides\u002Fdashboard","2.guides\u002F09.dashboard","i-lucide-layout-dashboard",{"title":80,"path":81,"stem":82,"icon":83},"Dead code","\u002Fguides\u002Fdead-code","2.guides\u002F10.dead-code","i-lucide-ghost",{"title":85,"path":86,"stem":87,"icon":88},"Comparing two codebases","\u002Fguides\u002Fcompare","2.guides\u002F11.compare","i-lucide-git-compare-arrows",{"title":90,"path":91,"stem":92,"icon":93},"Semantic clones","\u002Fguides\u002Fsemantic-clones","2.guides\u002F12.semantic-clones","i-lucide-brain-circuit",{"title":95,"icon":6,"path":96,"stem":97,"children":98,"page":6},"Concepts","\u002Fconcepts","3.concepts",[99,104,109],{"title":100,"path":101,"stem":102,"icon":103},"Types of code clones","\u002Fconcepts\u002Fclone-types","3.concepts\u002F1.clone-types","i-lucide-copy",{"title":105,"path":106,"stem":107,"icon":108},"How detection works","\u002Fconcepts\u002Fhow-detection-works","3.concepts\u002F2.how-detection-works","i-lucide-scan-search",{"title":110,"path":111,"stem":112,"icon":113},"The health score","\u002Fconcepts\u002Fhealth-score","3.concepts\u002F3.health-score","i-lucide-heart-pulse",{"title":115,"icon":6,"path":116,"stem":117,"children":118,"page":6},"Reference","\u002Freference","4.reference",[119,124,129,134,171,176,180],{"title":120,"path":121,"stem":122,"icon":123},"CLI options","\u002Freference\u002Fcli","4.reference\u002F1.cli","i-lucide-terminal",{"title":125,"path":126,"stem":127,"icon":128},"The config file","\u002Freference\u002Fconfig-file","4.reference\u002F2.config-file","i-lucide-settings",{"title":130,"path":131,"stem":132,"icon":133},"Exit codes","\u002Freference\u002Fexit-codes","4.reference\u002F3.exit-codes","i-lucide-log-out",{"title":135,"icon":6,"path":136,"stem":137,"children":138},"Reporters","\u002Freference\u002Freporters","4.reference\u002F4.reporters\u002Findex",[139,141,146,151,156,161,166],{"title":135,"path":136,"stem":137,"icon":140},"i-lucide-file-chart-column",{"title":142,"path":143,"stem":144,"icon":145},"HTML reporter","\u002Freference\u002Freporters\u002Fhtml","4.reference\u002F4.reporters\u002F2.html","i-lucide-file-code",{"title":147,"path":148,"stem":149,"icon":150},"JSON reporter","\u002Freference\u002Freporters\u002Fjson","4.reference\u002F4.reporters\u002F3.json","i-lucide-braces",{"title":152,"path":153,"stem":154,"icon":155},"Badge reporter","\u002Freference\u002Freporters\u002Fbadge","4.reference\u002F4.reporters\u002F4.badge","i-lucide-award",{"title":157,"path":158,"stem":159,"icon":160},"SARIF reporter","\u002Freference\u002Freporters\u002Fsarif","4.reference\u002F4.reporters\u002F5.sarif","i-lucide-shield-check",{"title":162,"path":163,"stem":164,"icon":165},"CodeClimate reporter","\u002Freference\u002Freporters\u002Fcodeclimate","4.reference\u002F4.reporters\u002F6.codeclimate","i-lucide-flag-triangle-right",{"title":167,"path":168,"stem":169,"icon":170},"OpenMetrics reporter","\u002Freference\u002Freporters\u002Fopenmetrics","4.reference\u002F4.reporters\u002F7.openmetrics","i-lucide-activity",{"title":172,"path":173,"stem":174,"icon":175},"Supported formats","\u002Freference\u002Fsupported-formats","4.reference\u002F5.supported-formats","i-lucide-languages",{"title":177,"path":178,"stem":179,"icon":38},"GitHub Action","\u002Freference\u002Fgithub-action","4.reference\u002F6.github-action",{"title":181,"path":182,"stem":183,"icon":68},"Rust crates","\u002Freference\u002Frust-crates","4.reference\u002F7.rust-crates",{"title":185,"icon":6,"path":186,"stem":187,"children":188,"page":6},"Project","\u002Fproject","5.project",[189,194,199,204,229,234],{"title":190,"path":191,"stem":192,"icon":193},"Changelog","\u002Fproject\u002Fchangelog","5.project\u002F1.changelog","i-lucide-scroll-text",{"title":195,"path":196,"stem":197,"icon":198},"Migrating from v4 to v5","\u002Fproject\u002Fmigration","5.project\u002F2.migration","i-lucide-arrow-right-left",{"title":200,"path":201,"stem":202,"icon":203},"jscpd v4 (TypeScript)","\u002Fproject\u002Fv4","5.project\u002F3.v4","i-simple-icons-typescript",{"title":205,"icon":6,"path":206,"stem":207,"children":208},"Benchmarks","\u002Fproject\u002Fbenchmarks","5.project\u002F4.benchmarks\u002Findex",[209,211,216,220,225],{"title":205,"path":206,"stem":207,"icon":210},"i-lucide-gauge",{"title":212,"path":213,"stem":214,"icon":215},"Detection Speed","\u002Fproject\u002Fbenchmarks\u002Fdetection-speed","5.project\u002F4.benchmarks\u002F2.detection-speed","i-lucide-zap",{"title":217,"path":218,"stem":219,"icon":58},"Multi-Format Detection","\u002Fproject\u002Fbenchmarks\u002Fcross-format","5.project\u002F4.benchmarks\u002F3.cross-format",{"title":221,"path":222,"stem":223,"icon":224},"AI Token Efficiency","\u002Fproject\u002Fbenchmarks\u002Fai-token-efficiency","5.project\u002F4.benchmarks\u002F4.ai-token-efficiency","i-lucide-sparkles",{"title":226,"path":227,"stem":228,"icon":93},"Embedding Models","\u002Fproject\u002Fbenchmarks\u002Fembedding-models","5.project\u002F4.benchmarks\u002F5.embedding-models",{"title":230,"path":231,"stem":232,"icon":233},"Research","\u002Fproject\u002Fresearch","5.project\u002F5.research","i-lucide-graduation-cap",{"title":235,"path":236,"stem":237,"icon":238},"Articles","\u002Fproject\u002Farticles","5.project\u002F6.articles","i-lucide-newspaper",{"id":240,"title":221,"body":241,"description":381,"extension":382,"links":383,"meta":384,"navigation":385,"path":222,"seo":386,"stem":223,"__hash__":389},"docs\u002F5.project\u002F4.benchmarks\u002F4.ai-token-efficiency.md",{"type":242,"value":243,"toc":376},"minimark",[244,253],[245,246,247,248,252],"p",{},"When CPD output is fed to an LLM (for automated refactoring, code review, or deduplication workflows), output size directly impacts cost, latency, and context window usage. jscpd's ",[249,250,251],"code",{},"--reporters ai"," flag is built for this; agents and LLM workflows should use it by default.",[254,255,256,261,267,304,316,319,329,333,366],"benchmark-token-efficiency",{},[257,258,260],"h2",{"id":259},"the-ai-reporter","The AI Reporter",[245,262,263,264,266],{},"The ",[249,265,251],{}," flag produces a token-efficient plain-text format designed for LLM consumption. Key optimizations:",[268,269,270,282,288,294],"ul",{},[271,272,273,277,278,281],"li",{},[274,275,276],"strong",{},"Common-path-prefix compression",": shared directory prefixes are factored out (e.g., ",[249,279,280],{},"fixtures\u002Fclike\u002F file1.cpp:1-88 ~ file2.cpp:1-88"," instead of two full paths)",[271,283,284,287],{},[274,285,286],{},"No code fragments",": only file paths and line ranges are reported",[271,289,290,293],{},[274,291,292],{},"Minimal structure",": one line per clone, no JSON overhead",[271,295,296,299,300,303],{},[274,297,298],{},"Summary line",": clone count and duplication percentage after a ",[249,301,302],{},"---"," separator",[245,305,306,307,311,312,315],{},"The AI reporter uses about 2,800 tokens for 212 clones (13 tokens per clone), an 8× reduction against the console reporter (about 23,000 tokens, 110 tokens per clone). The ",[308,309,310],"a",{"href":136},"reporters reference"," quotes a second measurement, about 79% fewer tokens (around 1,100 against 5,400), taken on an earlier ",[249,313,314],{},"fixtures\u002F"," tree of 132 files and 91 clones; the numbers on this page come from the 547-file benchmark corpus with 212 clones.",[245,317,318],{},"Sample output:",[320,321,327],"pre",{"className":322,"code":324,"language":325,"meta":326},[323],"language-text","fixtures\u002Fclike\u002F file1.cpp:1-88 ~ file2.cpp:1-88\nfixtures\u002Fclike\u002F file1.cs:1-91 ~ file2.cs:1-91\nfixtures\u002Fsvelte\u002F component1.svelte:css:112-230 ~ component2.svelte:css:112-230\nfixtures\u002Fmarkdown\u002F file3.md:typescript:34-64 ~ file4.md:typescript:34-64\n---\n212 clones · 37.1% duplication\n","text","",[249,328,324],{"__ignoreMap":326},[257,330,332],{"id":331},"methodology","Methodology",[268,334,335,344,354,360],{},[271,336,337,340,341,343],{},[274,338,339],{},"Target:"," ",[249,342,314],{}," directory, 547 files, 21,645 lines across 150+ formats",[271,345,346,349,350,353],{},[274,347,348],{},"Token estimation:"," Using ",[249,351,352],{},"cl100k_base"," tokenizer on each tool's default output",[271,355,356,359],{},[274,357,358],{},"Output formats:"," Each tool's primary output format (AI reporter, console, JSON, plain text)",[271,361,362,365],{},[274,363,364],{},"Hardware:"," Apple Silicon (Darwin arm64)",[245,367,368,369,375],{},"Full methodology details are in the ",[308,370,374],{"href":371,"rel":372},"https:\u002F\u002Fgithub.com\u002Fkucherenko\u002Fjscpd\u002Fblob\u002Fmaster\u002Fbenchmark\u002FBENCHMARK.md",[373],"nofollow","jscpd repository",".",{"title":326,"searchDepth":377,"depth":377,"links":378},2,[379,380],{"id":259,"depth":377,"text":260},{"id":331,"depth":377,"text":332},"How jscpd's AI reporter saves tokens compared to other CPD tools, an 8× reduction for LLM workflows.","md",null,{},{"icon":224},{"title":387,"description":388},"AI Token Efficiency — jscpd","jscpd's AI reporter uses ~2,800 tokens for 212 clones (13 tokens\u002Fclone), 8× fewer than the console reporter. Compare token efficiency across 6 CPD tools.","8ZoBXkTzalZeBKoCgrmItJ0pDq_amdxSr3_TtgzSCEI",[391,393],{"title":217,"path":218,"stem":219,"description":392,"icon":58,"children":-1},"How jscpd detects duplicates across Svelte, Astro, Vue, and Markdown formats — vs other tools.",{"title":226,"path":227,"stem":228,"description":394,"icon":93,"children":-1},"Nine open embedding models compared inside jscpd's experimental --semantic mode, with thresholds for each one.",1791302983353]