renderSummary method

String renderSummary()

Pretty-print a single-block summary of the comparison.

Implementation

String renderSummary() {
  String fmt(int bytes) => '${(bytes / 1024).toStringAsFixed(1)} KB';
  return [
    'Ingest FFI traffic ($docBytes B doc → $chunkCount chunks):',
    '  Legacy chain:  ${fmt(legacyTextTrafficBytes)}'
        ' (${legacyMultiple.toStringAsFixed(2)}× document)',
    '    add_source_in_collection:    ${fmt(legacy.legacyAddSourceInBytes.toInt())}',
    '    chunker text in:             ${fmt(legacy.legacyChunkerTextInBytes.toInt())}',
    '    chunker chunks out:          ${fmt(legacy.legacyChunkerChunksOutBytes.toInt())}',
    '    add_chunks:                  ${fmt(legacy.legacyAddChunksInBytes.toInt())}',
    '  IngestSession chain: ${fmt(sessionTextTrafficBytes)}'
        ' (${sessionMultiple.toStringAsFixed(2)}× document)',
    '    prepare content in:          ${fmt(session.sessionPrepareContentInBytes.toInt())}',
    '    take_embedding_batch out:    ${fmt(session.sessionEmbeddingTextOutBytes.toInt())}',
    '  Reduction: ${((1 - reductionRatio) * 100).toStringAsFixed(1)}%'
        ' (session / legacy = ${reductionRatio.toStringAsFixed(2)})',
  ].join('\n');
}