MCPcopy Create free account
hub / github.com/M4THYOU/TokenDagger / __init__

Method __init__

tests/code_performance_benchmark.py:67–108  ·  view source on GitHub ↗
(self, warmup_runs: int = 3, benchmark_runs: int = 25, tokenizer_type: str = "llama")

Source from the content-addressed store, hash-verified

65 """Performance benchmark specifically for code tokenization."""
66
67 def __init__(self, warmup_runs: int = 3, benchmark_runs: int = 25, tokenizer_type: str = "llama"):
68 self.repo_root = Path(__file__).parent.parent
69 self.warmup_runs = warmup_runs
70 self.benchmark_runs = benchmark_runs
71 self.tokenizer_type = tokenizer_type.lower()
72 self.results: List[CodeBenchmarkResult] = []
73
74 # Validate tokenizer type
75 if self.tokenizer_type not in ["llama", "mistral"]:
76 raise ValueError(f"Invalid tokenizer type: {tokenizer_type}. Must be 'llama' or 'mistral'")
77
78 # Code file extensions to test
79 self.code_extensions = {
80 '.py': 'Python',
81 '.cpp': 'C++',
82 '.c': 'C',
83 '.h': 'C Header',
84 '.hpp': 'C++ Header',
85 '.js': 'JavaScript',
86 '.ts': 'TypeScript',
87 '.java': 'Java',
88 '.rs': 'Rust',
89 '.go': 'Go',
90 '.rb': 'Ruby',
91 '.php': 'PHP',
92 '.cs': 'C#',
93 '.swift': 'Swift',
94 '.kt': 'Kotlin',
95 '.scala': 'Scala',
96 '.sh': 'Shell',
97 '.bat': 'Batch',
98 '.ps1': 'PowerShell',
99 '.sql': 'SQL',
100 '.json': 'JSON',
101 '.xml': 'XML',
102 '.yaml': 'YAML',
103 '.yml': 'YAML',
104 '.md': 'Markdown',
105 '.txt': 'Text',
106 '.makefile': 'Makefile',
107 '.cmake': 'CMake'
108 }
109
110 def setup_tokenizers(self):
111 """Initialize both tokenizers."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected