From commits-return-1140-archive-asf-public=cust-asf.ponee.io@zipkin.apache.org Fri May 10 14:03:38 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 70D5E18061A for ; Fri, 10 May 2019 16:03:38 +0200 (CEST) Received: (qmail 52826 invoked by uid 500); 10 May 2019 14:03:37 -0000 Mailing-List: contact commits-help@zipkin.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zipkin.apache.org Delivered-To: mailing list commits@zipkin.apache.org Received: (qmail 52817 invoked by uid 99); 10 May 2019 14:03:37 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 May 2019 14:03:37 +0000 From: GitBox To: commits@zipkin.apache.org Subject: [GitHub] [incubator-zipkin] adriancole edited a comment on issue #2579: Benchmark bytes / bytebuffer, protobuf vs zipkin vs wire. Message-ID: <155749701774.22503.18216595097011167049.gitbox@gitbox.apache.org> Date: Fri, 10 May 2019 14:03:37 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit adriancole edited a comment on issue #2579: Benchmark bytes / bytebuffer, protobuf vs zipkin vs wire. URL: https://github.com/apache/incubator-zipkin/pull/2579#issuecomment-491278374 cc also @swankjesse as this sort of thing is fun.. I think special peeking aside, it might boil down to if we can manage to read proto bytes as hex. if we can definitely wire should be better than it is now.. I added this to wire's ProtoReader though haven't tested it quite yet ```kotlin // stolen from okio private val HEX_DIGITS = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f') @Suppress("NOTHING_TO_INLINE") internal inline fun hex(data: BufferedSource, byteCount: Int): String { val result = CharArray(byteCount * 2) var i = 0 while (i < result.size) { val b = data.readByte().toInt(); result[i++] = HEX_DIGITS[b shr 4 and 0xf] result[i++] = HEX_DIGITS[b and 0xf] // ktlint-disable no-multi-spaces } return String(result) } /** * Reads a `bytes` field value from the stream as a lower-hex string. The length is read from the * stream prior to the actual data. */ @Throws(IOException::class) fun readBytesAsHex(): String { val byteCount = beforeLengthDelimitedScalar() source.require(byteCount) // Throws EOFException if insufficient bytes are available. return hex(source, byteCount.toInt()) } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services