@@ -79,14 +79,14 @@ func BenchmarkNormalizeIdentifier_Long(b *testing.B) {
7979// BenchmarkExtractIdentifiers measures per-line identifier extraction (regex + dedup).
8080func BenchmarkExtractIdentifiers (b * testing.B ) {
8181 lines := []string {
82- "\t firstName string `json:\" first_name\" `" , // Go struct field
83- "\t private String userEmailAddress;" , // Java field
84- "\t email_address: Optional[str] = None" , // Python
85- "export interface UserProfile { dateOfBirth: string }" , // TypeScript
86- "func (u *User) GetFullName() string { return u.FullName }" , // Go method
82+ "\t firstName string `json:\" first_name\" `" , // Go struct field
83+ "\t private String userEmailAddress;" , // Java field
84+ "\t email_address: Optional[str] = None" , // Python
85+ "export interface UserProfile { dateOfBirth: string }" , // TypeScript
86+ "func (u *User) GetFullName() string { return u.FullName }" , // Go method
8787 "// This is a comment with identifiers: email phone address" , // comment (should skip)
88- "" , // empty line
89- "const MAX_RETRY_COUNT = 3" , // constant
88+ "" , // empty line
89+ "const MAX_RETRY_COUNT = 3" , // constant
9090 }
9191
9292 b .ResetTimer ()
@@ -99,14 +99,14 @@ func BenchmarkExtractIdentifiers(b *testing.B) {
9999// BenchmarkExtractContainer measures per-line container detection (7 compiled regexes).
100100func BenchmarkExtractContainer (b * testing.B ) {
101101 lines := []string {
102- `type UserProfile struct {` , // Go struct
102+ `type UserProfile struct {` , // Go struct
103103 `class UserService extends BaseService {` , // Java/Python/TS class
104104 `interface PaymentProvider {` , // TypeScript interface
105105 `export type UserRecord = {` , // TypeScript type alias
106106 `data class UserData(val name: String) {` , // Kotlin data class
107107 `pub struct ConnectionPool {` , // Rust struct
108108 `func processPayment(amount float64) error {` , // non-container (no match)
109- ` return nil` , // non-container (no match)
109+ ` return nil` , // non-container (no match)
110110 }
111111
112112 b .ResetTimer ()
@@ -119,14 +119,14 @@ func BenchmarkExtractContainer(b *testing.B) {
119119// BenchmarkIsNonPIIIdentifier measures the filter function for false-positive suppression.
120120func BenchmarkIsNonPIIIdentifier (b * testing.B ) {
121121 identifiers := []string {
122- "fingerprint" , // filtered: non-biometric
123- "display_name" , // filtered: UI label
124- "file_name" , // filtered: code entity
125- "function_name" , // filtered: code entity
126- "email" , // NOT filtered: real PII
127- "first_name" , // NOT filtered: real PII
128- "host_name" , // filtered: infra
129- "user_fingerprint" , // NOT filtered: biometric context
122+ "fingerprint" , // filtered: non-biometric
123+ "display_name" , // filtered: UI label
124+ "file_name" , // filtered: code entity
125+ "function_name" , // filtered: code entity
126+ "email" , // NOT filtered: real PII
127+ "first_name" , // NOT filtered: real PII
128+ "host_name" , // filtered: infra
129+ "user_fingerprint" , // NOT filtered: biometric context
130130 }
131131
132132 b .ResetTimer ()
@@ -142,14 +142,14 @@ func BenchmarkMatchPII(b *testing.B) {
142142 scanner := NewPIIScanner (nil )
143143
144144 identifiers := []string {
145- "email" , // exact match (hit)
146- "first_name" , // exact match (hit)
147- "user_email" , // suffix match (hit)
148- "customer_phone" , // suffix match (hit)
149- "fingerprint" , // non-PII filter (filtered before lookup)
150- "engine_name" , // non-PII filter (filtered before lookup)
151- "query_result" , // no match (miss)
152- "backend_ladder" , // no match (miss)
145+ "email" , // exact match (hit)
146+ "first_name" , // exact match (hit)
147+ "user_email" , // suffix match (hit)
148+ "customer_phone" , // suffix match (hit)
149+ "fingerprint" , // non-PII filter (filtered before lookup)
150+ "engine_name" , // non-PII filter (filtered before lookup)
151+ "query_result" , // no match (miss)
152+ "backend_ladder" , // no match (miss)
153153 }
154154
155155 b .ResetTimer ()
0 commit comments