Return-Path: X-Original-To: apmail-avro-dev-archive@www.apache.org Delivered-To: apmail-avro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F1979DF1 for ; Tue, 20 Dec 2011 21:51:55 +0000 (UTC) Received: (qmail 68621 invoked by uid 500); 20 Dec 2011 21:51:54 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 68571 invoked by uid 500); 20 Dec 2011 21:51:54 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 68563 invoked by uid 99); 20 Dec 2011 21:51:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Dec 2011 21:51:54 +0000 X-ASF-Spam-Status: No, hits=-2002.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Dec 2011 21:51:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id C2C6611E5CE for ; Tue, 20 Dec 2011 21:51:30 +0000 (UTC) Date: Tue, 20 Dec 2011 21:51:30 +0000 (UTC) From: "Douglas Kaminsky (Updated) (JIRA)" To: dev@avro.apache.org Message-ID: <1573877182.32665.1324417890799.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <124930588.32651.1324417771096.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (AVRO-985) Remove byte-by-byte copying in RecordBuilderBase.defaultValue for non-complex types MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AVRO-985?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Douglas Kaminsky updated AVRO-985: ---------------------------------- Component/s: java > Remove byte-by-byte copying in RecordBuilderBase.defaultValue for non-complex types > ----------------------------------------------------------------------------------- > > Key: AVRO-985 > URL: https://issues.apache.org/jira/browse/AVRO-985 > Project: Avro > Issue Type: Improvement > Components: java > Affects Versions: 1.6.1 > Reporter: Douglas Kaminsky > > In one section of RecordBuilderBase.defaultValue(Field) (quoted below) a bytewise copy of the default object is created based on the JSON value provided. However, this is an extremely inefficient operation and causes large slowdowns when building large object sets, including latency spikes when the binary encoder flushes. > A simple workaround for a majority of cases would be to have a separate code path for "primitives" (fixed, string, boolean, int, double, enum, float, bytes) that allows direct creation rather than a full bytewise copy (and subsequent deep copy). > *_RecordBuilderBase.java_*: > {code} > // If not cached, get the default Java value by encoding the default JSON > // value and then decoding it: > if (defaultValue == null) { > ByteArrayOutputStream baos = new ByteArrayOutputStream(); > encoder = EncoderFactory.get().binaryEncoder(baos, encoder); > ResolvingGrammarGenerator.encode( > encoder, field.schema(), defaultJsonValue); > encoder.flush(); > decoder = DecoderFactory.get().binaryDecoder( > baos.toByteArray(), decoder); > defaultValue = new GenericDatumReader( > field.schema()).read(null, decoder); > defaultSchemaValues.putIfAbsent(field.pos(), defaultValue); > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira