INNER CODE UNIT · Python

_entry_bytes

BlessedRebuS/Krawl · src/database/core.py:79

def _entry_bytes(entry: dict) -> int:
    """Approximate heap cost of a buffered entry.

    Only the string payloads are worth counting — they are the part that
    varies by three orders of magnitude. The rest is a fixed dict overhead,
    approximated by the constant.
    """
    raw = entry.get("raw_request") or ""
    return (
        len(raw)
        + len(entry.get("path") or "")
        + len(entry.get("user_agent") or "")
        + len(entry.get("ip") or "")
        + 512
    )


def _buffer_access_log_entry(**kwargs) -> None:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…