avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject svn commit: r922373 - in /hadoop/avro/trunk: CHANGES.txt lang/c/src/encoding_binary.c
Date Fri, 12 Mar 2010 18:06:45 GMT
Author: massie
Date: Fri Mar 12 18:06:45 2010
New Revision: 922373

URL: http://svn.apache.org/viewvc?rev=922373&view=rev
Log:
AVRO-460. Performance improvement to write_long(). Contributed by Bruce Mitchener.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/lang/c/src/encoding_binary.c

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=922373&r1=922372&r2=922373&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Fri Mar 12 18:06:45 2010
@@ -36,6 +36,8 @@ Avro 1.3.1 (unreleased)
 
     AVRO-440. config.h output not correctly used (Bruce Mitchener via massie)
 
+    AVRO-460. Performance improvement to write_long() (Bruce Mitchener via massie)
+
   BUG FIXES
 
     AVRO-424. Fix the specification of the deflate codec.

Modified: hadoop/avro/trunk/lang/c/src/encoding_binary.c
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c/src/encoding_binary.c?rev=922373&r1=922372&r2=922373&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c/src/encoding_binary.c (original)
+++ hadoop/avro/trunk/lang/c/src/encoding_binary.c Fri Mar 12 18:06:45 2010
@@ -63,15 +63,15 @@ static int skip_long(avro_reader_t reade
 
 static int write_long(avro_writer_t writer, int64_t l)
 {
-	uint8_t b;
+	char buf[MAX_VARINT_BUF_SIZE];
+	uint8_t bytes_written = 0;
 	uint64_t n = (l << 1) ^ (l >> 63);
 	while (n & ~0x7F) {
-		b = ((((uint8_t) n) & 0x7F) | 0x80);
-		AVRO_WRITE(writer, &b, 1);
+		buf[bytes_written++] = (char)((((uint8_t) n) & 0x7F) | 0x80);
 		n >>= 7;
 	}
-	b = (uint8_t) n;
-	AVRO_WRITE(writer, &b, 1);
+	buf[bytes_written++] = (char)n;
+	AVRO_WRITE(writer, buf, bytes_written);
 	return 0;
 }
 



Mime
View raw message