Chia-Ping Tsai created KAFKA-21156:
--------------------------------------

             Summary: Avoid unnecessary char[] copy in 
ProcessorRecordContext#residentMemorySizeEstimate
                 Key: KAFKA-21156
                 URL: https://issues.apache.org/jira/browse/KAFKA-21156
             Project: Kafka
          Issue Type: Improvement
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


{code:java}
    public long residentMemorySizeEstimate() {
        long size = 0;
        size += Long.BYTES; // value.context.timestamp
        size += Long.BYTES; // value.context.offset
        if (topic != null) {
            size += topic.toCharArray().length;
        }
        size += Integer.BYTES; // partition
        for (final Header header : headers) {
            size += header.key().toCharArray().length;
            final byte[] value = header.value();
            if (value != null) {
                size += value.length;
            }
        }
        return size;
    } {code}
toCharArray().length -> topic.length()



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to