avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thiruvalluvan M. G. (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-354) Performance improvement to BinaryDecoder.readInt()
Date Tue, 26 Jan 2010 14:08:34 GMT

    [ https://issues.apache.org/jira/browse/AVRO-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805037#action_12805037
] 

Thiruvalluvan M. G. commented on AVRO-354:
------------------------------------------

Shown are the results for "Perf -N -i" and "Perf -i -N". All compilation takes place during
the warming up phase. It's not clear why the order of tests matter so much for readInt().

{code}
==== Perf -i -N
  1       java.lang.String::hashCode (60 bytes)
  2       java.lang.String::indexOf (166 bytes)
  3       java.lang.String::indexOf (151 bytes)
  4       java.lang.String::charAt (33 bytes)
  5       java.lang.String::lastIndexOf (156 bytes)
  6       java.io.Win32FileSystem::normalize (143 bytes)
  7       java.lang.String::replace (142 bytes)
  8       sun.net.www.ParseUtil::encodePath (336 bytes)
  9       java.lang.String::startsWith (78 bytes)
 10       java.lang.String::equals (88 bytes)
 11       java.lang.Object::<init> (1 bytes)
---   n   java.lang.System::arraycopy (static)
 12       java.lang.AbstractStringBuilder::append (40 bytes)
 13       java.io.Win32FileSystem::isSlash (18 bytes)
 14 s     java.lang.StringBuffer::append (8 bytes)
 15       java.io.Win32FileSystem::normalize (231 bytes)
 16       java.lang.Math::min (11 bytes)
 17       java.lang.CharacterDataLatin1::getProperties (11 bytes)
 18       java.lang.StringBuilder::append (8 bytes)
 19  !    sun.net.www.ParseUtil::decode (194 bytes)
 20       java.lang.Character::toLowerCase (162 bytes)
 21       java.lang.CharacterDataLatin1::toLowerCase (36 bytes)
 22       java.lang.String::getChars (66 bytes)
 23       java.lang.AbstractStringBuilder::append (60 bytes)
 24       org.apache.avro.io.BinaryEncoder::encodeLong (50 bytes)
 25 s     java.io.ByteArrayOutputStream::write (55 bytes)
---   n   sun.misc.Unsafe::compareAndSwapLong
 26       java.util.Random::nextInt (60 bytes)
 27       java.util.Random::next (47 bytes)
 28       java.util.concurrent.atomic.AtomicLong::get (5 bytes)
 29       java.util.concurrent.atomic.AtomicLong::compareAndSet (13 bytes)
 30       org.apache.avro.io.BinaryEncoder::writeInt (10 bytes)
  1%      org.apache.avro.io.Perf$ReadInt::genData @ 20 (75 bytes)
 31       java.lang.String::startsWith (7 bytes)
 32       org.apache.avro.io.Perf$ReadInt::genData (75 bytes)
 33 s     java.io.ByteArrayInputStream::read (36 bytes)
 34       org.apache.avro.io.BinaryDecoder::readInt (59 bytes)
 35       org.apache.avro.io.Perf$ReadInt::readInternal (6 bytes)
  2%      org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
  2%  made not entrant  (2)  org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
 36       org.apache.avro.io.Perf$Test::read (60 bytes)
  3%      org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
Warmed up
ReadInt: 1183 ms, 25.337923438930538 million entries/sec
 35   made not entrant  (2)  org.apache.avro.io.Perf$ReadInt::readInternal (6 bytes)
  3%  made not entrant  (2)  org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
  4%      org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
 37       org.apache.avro.io.parsing.Parser::advance (130 bytes)
 37   made not entrant  (2)  org.apache.avro.io.parsing.Parser::advance (130 bytes)
 38       org.apache.avro.io.parsing.Parser::pushProduction (54 bytes)
 39       org.apache.avro.io.parsing.Parser::advance (130 bytes)
 36   made not entrant  (2)  org.apache.avro.io.Perf$Test::read (60 bytes)
 40       org.apache.avro.io.Perf$Test::read (60 bytes)
 41       org.apache.avro.io.ValidatingDecoder::readInt (19 bytes)
Warmed up
NestedRecordTest: 2003 ms, 14.973407228761719 million entries/sec

==== Perf -N -i
  1       java.lang.String::hashCode (60 bytes)
  2       java.lang.String::indexOf (166 bytes)
  3       java.lang.String::indexOf (151 bytes)
  4       java.lang.String::charAt (33 bytes)
  5       java.lang.String::lastIndexOf (156 bytes)
  6       java.io.Win32FileSystem::normalize (143 bytes)
  7       java.lang.String::replace (142 bytes)
  8       sun.net.www.ParseUtil::encodePath (336 bytes)
  9       java.lang.String::startsWith (78 bytes)
 10       java.lang.String::equals (88 bytes)
---   n   java.lang.System::arraycopy (static)
 11       java.lang.Object::<init> (1 bytes)
 12       java.lang.AbstractStringBuilder::append (40 bytes)
 13       java.lang.Math::min (11 bytes)
 14       java.io.Win32FileSystem::isSlash (18 bytes)
 15 s     java.lang.StringBuffer::append (8 bytes)
 16       java.io.Win32FileSystem::normalize (231 bytes)
 17       java.lang.CharacterDataLatin1::getProperties (11 bytes)
 18       java.lang.StringBuilder::append (8 bytes)
 19  !    sun.net.www.ParseUtil::decode (194 bytes)
 20       java.lang.Character::toLowerCase (162 bytes)
 21       java.lang.CharacterDataLatin1::toLowerCase (36 bytes)
 22       java.lang.String::getChars (66 bytes)
 23       java.lang.AbstractStringBuilder::append (60 bytes)
 24       java.lang.String::startsWith (7 bytes)
 25       org.apache.avro.io.BinaryEncoder::encodeLong (50 bytes)
 26 s     java.io.ByteArrayOutputStream::write (55 bytes)
---   n   sun.misc.Unsafe::compareAndSwapLong
 27       java.util.Random::nextInt (60 bytes)
 28       java.util.Random::next (47 bytes)
 29       java.util.concurrent.atomic.AtomicLong::get (5 bytes)
 30       java.util.concurrent.atomic.AtomicLong::compareAndSet (13 bytes)
 31       org.apache.avro.io.BinaryEncoder::writeInt (10 bytes)
  1%      org.apache.avro.io.Perf$ReadInt::genData @ 20 (75 bytes)
 32 s     java.io.ByteArrayInputStream::read (36 bytes)
 33       org.apache.avro.io.BinaryDecoder::readInt (59 bytes)
 34       org.apache.avro.io.parsing.Parser::advance (130 bytes)
 35       org.apache.avro.io.Perf$ReadInt::readInternal (6 bytes)
 36       org.apache.avro.io.ValidatingDecoder::readInt (19 bytes)
  2%      org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
 34   made not entrant  (2)  org.apache.avro.io.parsing.Parser::advance (130 bytes)
  2%  made not entrant  (2)  org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
 37       org.apache.avro.io.Perf$Test::read (60 bytes)
  3%      org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
Warmed up
NestedRecordTest: 1998 ms, 15.008795153960222 million entries/sec
 35   made not entrant  (2)  org.apache.avro.io.Perf$ReadInt::readInternal (6 bytes)
  3%  made not entrant  (2)  org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
  4%      org.apache.avro.io.Perf$Test::read @ 24 (60 bytes)
 38       org.apache.avro.io.Perf$ReadInt::readInternal (6 bytes)
 37   made not entrant  (2)  org.apache.avro.io.Perf$Test::read (60 bytes)
 39       org.apache.avro.io.Perf$Test::read (60 bytes)
Warmed up
ReadInt: 1038 ms, 28.884648194613206 million entries/sec

{code}


> Performance improvement to BinaryDecoder.readInt()
> --------------------------------------------------
>
>                 Key: AVRO-354
>                 URL: https://issues.apache.org/jira/browse/AVRO-354
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.0
>         Environment: koliver@koliver-ws4:~$ uname -a
> Linux koliver-ws4 2.6.24-26-generic #1 SMP Tue Dec 1 17:55:03 UTC 2009 x86_64 GNU/Linux
>            Reporter: Kevin Oliver
>            Priority: Minor
>         Attachments: AVRO-354-results.csv, AVRO-354.patch
>
>
> Able to get a 3-7% improvement on Perf -i by creating a specialized version of BinaryDecoder.readInt()
that uses the same code as readLong() but uses ints instead of long for all its math and bit
arithmetic.
> The performance improvement is larger on a 32-bit VM (around 7%) than on a 64-bit VM
(around 3%). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message