1---2name: 2916-performance-evaluation-factors-42d9ffc63description: Performance Evaluation Factors (140 CLI-Evaluatable)4---5# Performance Evaluation Factors (140 CLI-Evaluatable)67## 1. CPU and Compute (12 factors)89| # | Factor | Description | CLI Tool | Security Note |10|---|--------|-------------|----------|---------------|11| 1 | Algorithm complexity | Big O analysis of core functions | lizard, radon | Constant-time required for crypto operations |12| 2 | Hot path identification | 80/20 rule: find the 20% causing 80% of load | perf, async-profiler | - |13| 3 | Branch prediction impact | Mispredicted branches cost 10-20 cycles each | perf stat | - |14| 4 | SIMD vectorization | Compiler auto-vectorization opportunities | gcc/clang -fopt-info-vec | - |15| 5 | Cache locality | L1 cache hit vs main memory: 1ns vs 100ns | perf stat, cachegrind | - |16| 6 | False sharing | Cache line contention between cores | perf c2c | - |17| 7 | Lock contention | Mutex wait time as percentage of execution | perf lock, mutrace | - |18| 8 | Context switching overhead | Thread/process switch cost | perf stat | - |19| 9 | Compiler optimization flags | -O0 vs -O3 can mean 10x difference | Semgrep (build files) | - |20| 10 | CPU limits in Kubernetes | Missing limits cause noisy neighbor problems | kube-linter, Kubescape | - |21| 11 | Cgroup configuration | v2 provides better resource isolation | Kubescape | - |22| 12 | NUMA awareness | Multi-socket servers need explicit memory placement | Semgrep, numactl | - |2324---2526## 2. Memory (9 factors)2728| # | Factor | Description | CLI Tool | Security Note |29|---|--------|-------------|----------|---------------|30| 13 | Allocation patterns | Object pooling vs heap allocation per request | heaptrack, Valgrind massif | Zero sensitive data before returning to pools |31| 14 | Stack vs heap allocation | Stack allocation is 100x faster than heap | Valgrind, AddressSanitizer | - |32| 15 | GC pressure | Frequent allocations trigger stop-the-world pauses | async-profiler, scalene | - |33| 16 | Working set size | Must fit in available RAM to avoid swapping | perf stat | - |34| 17 | Memory alignment | Misaligned access costs 2-10x on some architectures | pahole, Semgrep | - |35| 18 | Copy elimination | Zero-copy parsing avoids allocation overhead | Semgrep | - |36| 19 | Container memory limits | Missing limits risk OOM killer termination | kube-linter, Kubescape | - |37| 20 | Memory swappiness | Disable swap for containers to prevent latency spikes | Kubescape | - |38| 21 | Unbounded collection growth | Missing size limits cause memory exhaustion | Semgrep | Prevents memory exhaustion attacks |3940---4142## 3. Disk I/O (10 factors)4344| # | Factor | Description | CLI Tool | Security Note |45|---|--------|-------------|----------|---------------|46| 22 | Blocking vs async I/O | Blocking I/O ties up threads waiting for disk | Semgrep, strace | - |47| 23 | Access patterns | Sequential: 500MB/s, Random: 1MB/s on spinning disk | blktrace, strace | - |48| 24 | Buffer sizing | Match filesystem block size (typically 4KB) | strace | - |49| 25 | Write batching | Each fsync costs 5-20ms on HDD | Semgrep | Sync audit logs immediately |50| 26 | Memory-mapped files | Efficient for large file random access | Semgrep | Check file permissions before mmap |51| 27 | Container overlay filesystem | Each layer adds lookup overhead | dive, Hadolint | - |52| 28 | Copy-on-write penalty | First write to overlayed file copies entire file | dive | - |53| 29 | Volume mount types | Bind mounts faster than named volumes | kube-linter | - |54| 30 | tmpfs for ephemeral data | RAM-backed filesystem for temp files | kube-linter, Kubescape | Sensitive temp data stays in memory |55| 31 | Storage driver selection | overlay2 preferred over aufs/devicemapper | Trivy, Hadolint | - |5657---5859## 4. Network I/O (14 factors)6061| # | Factor | Description | CLI Tool | Security Note |62|---|--------|-------------|----------|---------------|63| 32 | Connection pooling | TCP handshake costs 1-3 RTTs | Semgrep | Re-authenticate pooled connections |64| 33 | Async I/O for high concurrency | Threads don't scale past thousands of connections | Semgrep | - |65| 34 | Request batching | Combine multiple operations into single round-trip | Semgrep | - |66| 35 | Serialization format overhead | JSON parsing 10-100x slower than Protocol Buffers | Semgrep, hyperfine | Validate all deserialized data |67| 36 | TCP tuning | Nagle's algorithm adds 40ms delay for small packets | Semgrep | - |68| 37 | Container network mode | Bridge adds NAT overhead vs host mode | kube-linter, Kubescape | Host mode reduces isolation |69| 38 | Network policy rule count | Large iptables rulesets add per-packet overhead | Kubescape | Default deny is worth the overhead |70| 39 | DNS resolution caching | Uncached DNS adds 10-100ms per lookup | Semgrep | Never hardcode IPs (breaks cert validation) |71| 40 | Service mesh sidecar overhead | Each hop adds 1-5ms latency | Kubescape | mTLS overhead is worth the security |72| 41 | CNI plugin selection | eBPF-based (Calico, Cilium) faster than iptables | Kubescape | - |73| 42 | Chatty interface detection | Multiple sequential calls vs single batch | Semgrep | - |74| 43 | Synchronous external calls | Blocking HTTP in request handlers kills throughput | Semgrep | - |75| 44 | Retry logic | Missing: single failure breaks chain. Infinite: amplifies outages | Semgrep | Never log credentials in retry attempts |76| 45 | Timeout configuration | Missing timeouts cause resource exhaustion | Semgrep | Prevents slowloris attacks |7778---7980## 5. Database (7 factors)8182| # | Factor | Description | CLI Tool | Security Note |83|---|--------|-------------|----------|---------------|84| 46 | N+1 query detection | 1 query + N child queries vs 1 query with JOIN | Semgrep, sqlfluff | - |85| 47 | Missing index indicators | WHERE/ORDER BY on unindexed columns | sqlfluff, pt-query-digest | - |86| 48 | Connection pool sizing | Too small: contention. Too large: memory waste | Semgrep | - |87| 49 | Prepared statement usage | Parse once, execute many. Also prevents SQL injection | Semgrep | Prevents SQL injection |88| 50 | Result set pagination | SELECT without LIMIT returns unbounded rows | Semgrep | Prevents enumeration attacks |89| 51 | ORM query inspection | ORMs generate suboptimal SQL without review | Semgrep | - |90| 52 | Eager loading patterns | select_related/prefetch_related vs lazy loading | Semgrep | - |9192---9394## 6. Caching (5 factors)9596| # | Factor | Description | CLI Tool | Security Note |97|---|--------|-------------|----------|---------------|98| 53 | Eviction policy configuration | LRU vs TTL vs size-based depends on access pattern | Semgrep | TTLs must align with session lifetimes |99| 54 | Cache stampede prevention | Lock or probabilistic refresh on expiration | Semgrep | - |100| 55 | Cache serialization cost | JSON serialization can negate cache benefit | hyperfine | Validate cached data on deserialization |101| 56 | Repeated parsing elimination | Parse once, cache structured result | Semgrep | - |102| 57 | Cache key construction | Missing user context enables cache poisoning | Semgrep | Include auth context in cache keys |103104---105106## 7. Concurrency Patterns (9 factors)107108| # | Factor | Description | CLI Tool | Security Note |109|---|--------|-------------|----------|---------------|110| 58 | Lock granularity | Global locks serialize everything | Semgrep, ThreadSanitizer | - |111| 59 | Read-write lock usage | Multiple readers, exclusive writers | Semgrep | - |112| 60 | Lock-free structure correctness | Incorrect atomics cause data corruption | Semgrep, Helgrind | Verify with formal methods before deploying |113| 61 | Thread pool sizing | CPU-bound: core count. I/O-bound: higher | Semgrep | Limit pool size to prevent thread exhaustion |114| 62 | Blocking calls in async context | Sync I/O in async function blocks event loop | Semgrep | - |115| 63 | Unnecessary async overhead | Async for CPU-bound work adds overhead | Semgrep | - |116| 64 | Sequential awaits in loops | await in loop executes serially | Semgrep | - |117| 65 | Over-synchronization | Locking more than necessary kills parallelism | Semgrep | Prove thread safety before removing locks |118| 66 | Thread-per-request assumption | Doesn't scale past thousands of concurrent requests | Semgrep | - |119120---121122## 8. Code-Level Patterns (7 factors)123124| # | Factor | Description | CLI Tool | Security Note |125|---|--------|-------------|----------|---------------|126| 67 | String concatenation in loops | O(n²) complexity. Use StringBuilder or join() | Semgrep | - |127| 68 | Regex compilation placement | Compile once outside loop, not per iteration | Semgrep | User-controlled regex enables ReDoS |128| 69 | Exception for control flow | Stack unwinding is expensive. Use conditionals | Semgrep | Never expose stack traces to users |129| 70 | Reflection in hot paths | 10-100x slower than direct calls | Semgrep | - |130| 71 | Lazy initialization overhead | Double-checked locking on every access | Semgrep | - |131| 72 | Collection type mismatch | List for membership test vs Set for O(1) lookup | Semgrep | - |132| 73 | String concatenation for queries | Performance and security disaster | Semgrep | Use parameterized queries |133134---135136## 9. Abstraction and Structure (5 factors)137138| # | Factor | Description | CLI Tool | Security Note |139|---|--------|-------------|----------|---------------|140| 74 | Over-abstraction | Interface with single implementation adds indirection | lizard, Semgrep | More code means more attack surface |141| 75 | Premature generalization | Generic code for single use case | Semgrep | - |142| 76 | Design pattern theater | Factory for simple instantiation | lizard, Semgrep | - |143| 77 | Wrapper explosion | Thin wrappers that add no value | Semgrep | - |144| 78 | DTO mapping chains | A→B→C→D when A→D would suffice | Semgrep | Mapping layers that filter sensitive fields add value |145146---147148## 10. Dependencies and Imports (4 factors)149150| # | Factor | Description | CLI Tool | Security Note |151|---|--------|-------------|----------|---------------|152| 79 | Dependency bloat | Unused dependencies increase attack surface and size | Trivy, deptry, depcheck | Fewer dependencies means fewer CVEs |153| 80 | Transitive dependency blindness | One import brings 200+ transitive deps | Trivy, pipdeptree, npm ls | Each transitive dep is a supply chain risk |154| 81 | Framework maximalism | Full framework for subset of features | Trivy, Semgrep | - |155| 82 | Reinventing standard library | Custom implementations of stdlib functions | Semgrep | Stdlib receives more security scrutiny |156157---158159## 11. Code Volume and Redundancy (5 factors)160161| # | Factor | Description | CLI Tool | Security Note |162|---|--------|-------------|----------|---------------|163| 83 | Excessive null handling | Optional/Maybe everywhere without proof of necessity | Semgrep | - |164| 84 | Copy-paste with variations | Same logic slightly modified in multiple places | jscpd, PMD CPD | Bug fixes miss copies |165| 85 | Comment noise | Comments that restate obvious code | Semgrep | - |166| 86 | Dead code | Unreachable code still gets compiled and deployed | vulture, ts-prune, deadcode | Dead code expands attack surface |167| 87 | Boilerplate explosion | Getters/setters/builders for simple data | Semgrep | Auto-generated toString leaks sensitive fields |168169---170171## 12. Type and Error Handling (4 factors)172173| # | Factor | Description | CLI Tool | Security Note |174|---|--------|-------------|----------|---------------|175| 88 | Exception class proliferation | Custom exception per error vs standard types | Semgrep, file count | - |176| 89 | Swallowed exceptions | catch (Exception e) { } hides failures | Semgrep | Log security-relevant exceptions |177| 90 | Sensitive data in logs | Passwords, tokens, PII in log statements | Semgrep | Never log credentials or PII |178| 91 | Redundant validation | Same validation at multiple layers | Semgrep | Validate untrusted input at boundary only |179180---181182## 13. Container Image and Build (6 factors)183184| # | Factor | Description | CLI Tool | Security Note |185|---|--------|-------------|----------|---------------|186| 92 | Image layer count | Each layer adds filesystem overhead | dive | - |187| 93 | Image size | Distroless: 50MB. Full OS: 2GB | dive, docker images | Smaller image means smaller attack surface |188| 94 | Build cache efficiency | Layer ordering affects rebuild time | Hadolint | - |189| 95 | Base image selection | Alpine/distroless vs full Ubuntu | Hadolint, Trivy | Distroless eliminates shell for attackers |190| 96 | Image vulnerability scanning | Known CVEs in base image and dependencies | Trivy | Block deployment on critical CVEs |191| 97 | Image signing and verification | Unsigned images can be tampered | cosign, Trivy | Verify signatures before deployment |192193---194195## 14. Container Runtime (4 factors)196197| # | Factor | Description | CLI Tool | Security Note |198|---|--------|-------------|----------|---------------|199| 98 | Container startup time | Cold start latency affects scaling | hyperfine | - |200| 99 | Unnecessary binaries in image | curl, wget, shell expand attack surface | dive, Trivy | Remove debugging tools from production |201| 100 | Security profile overhead | seccomp/AppArmor adds syscall filtering | kube-linter, Kubescape | Never disable for performance |202| 101 | Privileged mode usage | Privileged containers bypass all isolation | Kubescape | Never use privileged mode |203204---205206## 15. Orchestration Layer (5 factors)207208| # | Factor | Description | CLI Tool | Security Note |209|---|--------|-------------|----------|---------------|210| 102 | Resource request/limit gaps | Requests too low causes scheduling failures | kube-linter, Kubescape | - |211| 103 | Probe configuration | Aggressive probes add unnecessary load | kube-linter | - |212| 104 | Pod density optimization | Too few pods per node wastes resources | Kubescape | - |213| 105 | Network policy enforcement | Missing policies allow lateral movement | kube-linter, Kubescape | Default deny all, allow explicitly |214| 106 | Pod security standards | Privileged pods undermine isolation | Kubescape | Enforce restricted or baseline |215216---217218## 16. Logging and Observability (6 factors)219220| # | Factor | Description | CLI Tool | Security Note |221|---|--------|-------------|----------|---------------|222| 107 | Log driver configuration | json-file driver blocks on full buffer | Hadolint | - |223| 108 | Log volume in hot paths | Debug logging in request handlers adds latency | Semgrep | - |224| 109 | High-cardinality metrics | User ID as label explodes metric count | Semgrep | - |225| 110 | Trace context propagation | Missing headers break distributed tracing | Semgrep | - |226| 111 | Percentile metric usage | P99/P999 reveal tail latency | Semgrep | - |227| 112 | Audit log separation | Audit logs need tamper-evident storage | Semgrep, Kubescape | Separate audit logs from application logs |228229---230231## 17. Architecture (5 factors)232233| # | Factor | Description | CLI Tool | Security Note |234|---|--------|-------------|----------|---------------|235| 113 | Service call depth | Each hop adds latency and failure probability | Semgrep, service count | Each boundary is a trust boundary |236| 114 | Serialization boundary overhead | Every service boundary requires serialize/deserialize | Semgrep | Validate at every boundary |237| 115 | Microservice fragmentation | Too many services increases operational complexity | cloc, Dockerfile count | More services means more attack surface |238| 116 | Configuration sprawl | Config files scattered across services | Semgrep | Never store secrets in env vars |239| 117 | Inconsistent patterns across services | Mixed async models, multiple HTTP clients | Semgrep | Inconsistency breeds security gaps |240241---242243## 18. AI-Generated Code Detection (9 factors)244245| # | Factor | Description | CLI Tool | Security Note |246|---|--------|-------------|----------|---------------|247| 118 | Cyclomatic complexity spikes | AI generates correct but convoluted code | lizard | Complex code hides vulnerabilities |248| 119 | Allocation pattern analysis | AI often allocates unnecessarily | heaptrack, scalene | - |249| 120 | Dependency audit for bloat | AI adds dependencies for single functions | Trivy, deptry | Each dep is a supply chain risk |250| 121 | Binary size tracking | Unexplained size increases indicate bloat | size, bloaty | - |251| 122 | Startup time regression | New code slows initialization | hyperfine | - |252| 123 | Performance benchmark gates | CI must catch performance regressions | k6, hyperfine | - |253| 124 | Security pattern coverage | AI misses security patterns that scanners catch | Semgrep | AI optimizes for correctness not security |254| 125 | Excessive mocking in tests | AI over-mocks, hiding integration issues | Semgrep | Mocks hide security integration failures |255| 126 | Missing performance tests | AI rarely generates benchmarks | grep, Semgrep | - |256257---258259## 19. Security-Specific Patterns (14 factors)260261| # | Factor | Description | CLI Tool | Security Note |262|---|--------|-------------|----------|---------------|263| 127 | SQL injection vectors | String concatenation in queries | Semgrep | Use parameterized queries |264| 128 | Command injection vectors | User input in shell commands | Semgrep | Use subprocess with array args |265| 129 | Path traversal vectors | User input in file paths | Semgrep | Validate and canonicalize paths |266| 130 | SSRF vectors | User input in URLs | Semgrep | Allowlist permitted hosts |267| 131 | Deserialization of untrusted data | Pickle, YAML load, Java serialization | Semgrep, Trivy | Use safe loaders only |268| 132 | Hardcoded secrets | API keys, passwords in source | Trivy, Semgrep | Use secret managers |269| 133 | Weak cryptography | MD5, SHA1, DES, small key sizes | Semgrep | Use current NIST recommendations |270| 134 | Insufficient randomness | Random vs SecureRandom | Semgrep | Use CSPRNG for security contexts |271| 135 | Missing input validation | Trust boundary without validation | Semgrep | Validate at system boundary |272| 136 | Missing output encoding | XSS via unencoded output | Semgrep | Context-appropriate encoding |273| 137 | Insecure TLS configuration | TLS 1.0/1.1, weak ciphers | Semgrep, Trivy | TLS 1.2+ with strong ciphers |274| 138 | Missing authentication checks | Endpoints without auth verification | Semgrep | Auth check on every protected endpoint |275| 139 | Missing authorization checks | Auth present but no permission check | Semgrep | Authorize every resource access |276| 140 | Exposed debug endpoints | /debug, /metrics without auth | Semgrep, Kubescape | Disable or protect in production |