Skip to content

[Efficiency Improver] Monthly Activity 2026-06Β #583

Description

@github-actions

πŸ€– Weekly Efficiency Improver here β€” I'm an automated AI assistant focused on reducing the energy consumption and computational footprint of this repository.

Activity for June 2026

Suggested Actions for Maintainer

Energy Efficiency Backlog

Priority Focus Area Opportunity Estimated Impact
DONE Code-Level RateLimiter map[string]*visitor β†’ map[string]visitor (PR #582) Eliminates 1 heap alloc per unique IP
DONE Code-Level hotpCodeWithMAC: mac.Sum(nil) β†’ stack [sha1.Size]byte buf (PR this run) 2 allocs/op β†’ 1 alloc/op per HOTP call; Γ—3 per ValidateTOTP
LOW Code-Level RBAC rolePermissions as map[Role]map[Permission]struct{} for O(1) permission lookup (current n≀5, linear is fine) LOW: marginal at current scale
LOW Measurement Add benchmark for the full middleware auth flow (JWT validate + session lookup) LOW: infrastructure/observability

Discovered Commands

Command Purpose
go test -v ./... / make test Run full test suite
gotestsum -- -v ./... / make testsum Tests with richer output
make lint golangci-lint (v2)
go fmt ./... / make fmt Standard Go formatting
go tool gofumpt -w -l . / make hardfmt Stricter formatting
go test -bench=BenchmarkValidateTOTP -benchmem ./auth/ TOTP benchmark
go test -bench=BenchmarkHotpCodeWithMAC -benchmem ./auth/ HOTP inner-loop benchmark
go test -bench=BenchmarkRateLimiterAllow -benchmem ./auth/ Rate limiter benchmark

Note: CI uses Go 1.26.1; local runner has 1.25.11 β€” tests/builds must be verified through CI.

Run History

2026-06-29 06:05 UTC β€” Run

  • πŸ” Identified: mac.Sum(nil) in hotpCodeWithMAC allocates a 20-byte heap slice per call β€” Γ—3 per ValidateTOTP invocation
  • πŸ”§ Created PR (branch efficiency/totp-stack-buf-sum): Replace mac.Sum(nil) with mac.Sum(hBuf[:0]) where hBuf is a [sha1.Size]byte stack array β€” eliminates the HMAC heap alloc, 2 allocs/op β†’ 1 alloc/op per HOTP call
  • πŸ“Š Estimated: BenchmarkHotpCodeWithMAC -benchmem will confirm: 2 allocs/op β†’ 1 alloc/op; BenchmarkValidateTOTP 6 allocs β†’ 3 allocs
  • 🌱 GSF principle: Hardware Efficiency β€” stack buffer keeps hash data in the stack frame (L1 cache); Energy Proportionality β€” fewer GC-tracked pointers per request

2026-06-22 06:15 UTC β€” Run

  • πŸ” Identified: map[string]*visitor in RateLimiter allocates one *visitor per unique IP on the heap β€” GC pressure scales with unique IP count
  • πŸ”§ Created PR [Efficiency Improver] perf(auth): eliminate per-IP heap allocation in RateLimiterΒ #582: Switch to map[string]visitor (value map) β€” eliminates per-IP heap allocation, improves cache locality
  • πŸ“Š Estimated: 1 alloc/op β†’ 0 allocs/op for new-visitor path (BenchmarkRateLimiterAllow_newVisitors)
  • 🌱 GSF principle: Hardware Efficiency β€” inline map values improve cache utilisation vs pointer-chasing to scattered heap objects

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

Generated by Weekly Efficiency Improver Β· 563.6 AIC Β· βŒ– 30.7 AIC Β· ⊞ 41.1K Β· β—·

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/daily-efficiency-improver.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions