harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Wu <wuyue...@gmail.com>
Subject Re: [classlib][luni] Performance improvement patch in java.io.unread(byte[] buffer, int offset, int length)
Date Wed, 18 Feb 2009 03:29:57 GMT
Hi Daven,
I noticed that we might have your acq already. probably it's hard to
map your English name to Chinese name ;-)

is this one?

pmc/harmony/auth_cont_quests/dingwei_you_acq_2008-06-12.pdf

2009/2/17 Deven You <devyoudw@gmail.com>:
> thanks Alexei, I have already signed the ACQ, I will confirm it. and the
> JIRA has created.
>
> 2009/2/17 Alexei Fedotov <alexei.fedotov@gmail.com>
>
>> Hello Deven,
>> Thank you for your contribution! It would be nice to see how real-life
>> applications improved with this fix.
>>
>> Could you please send the patch via JIRA [1]? We also need your ACQ to
>> be sent to private@harmony.apache.org (see details at [2]).
>>
>> [1] https://issues.apache.org/jira/browse/HARMONY
>> [2] http://harmony.apache.org/contribution_policy.html
>>
>> 2009/2/17 Deven You <devyoudw@gmail.com>:
>> > Hi,
>> > the patch is as below:
>> > Index: src/main/java/java/io/PushbackInputStream.java
>> > ===================================================================
>> > --- src/main/java/java/io/PushbackInputStream.java      (Version 743234)
>> > +++ src/main/java/java/io/PushbackInputStream.java      (Working copy)
>> > @@ -282,9 +282,11 @@
>> >              throw new ArrayIndexOutOfBoundsException();
>> >          }
>> >
>> > -        for (int i = offset + length - 1; i >= offset; i--) {
>> > -            unread(buffer[i]);
>> > +        if (buf == null) {
>> > +            throw new IOException();
>> >          }
>> > +        System.arraycopy(buffer, offset, buf, pos - length, length);
>> > +        pos = pos - length;
>> >      }
>> >
>> > I have write a test as below:
>> >
>> > import java.io.ByteArrayInputStream;
>> > import java.io.File;
>> > import java.io.IOException;
>> > import java.io.PushbackInputStream;
>> >
>> > public class PushbackInputStream_Unread_$BII {
>> >
>> >     /**
>> >      * @param args
>> >      */
>> >     public static void main(String[] args) {
>> >         // setUp
>> >         String fileString =
>> >
>> "Test_All_Tests\nTest_java_io_BufferedInputStream\nTest_java_io_BufferedOutputStream\nTest_java_io_ByteArrayInputStream\nTest_java_io_ByteArrayOutputStream\nTest_java_io_DataInputStream\nTest_java_io_File\nTest_java_io_FileDescriptor\nTest_java_io_FileInputStream\nTest_java_io_FileNotFoundException\nTest_java_io_FileOutputStream\nTest_java_io_FilterInputStream\nTest_java_io_FilterOutputStream\nTest_java_io_InputStream\nTest_java_io_IOException\nTest_java_io_OutputStream\nTest_java_io_PrintStream\nTest_java_io_RandomAccessFile\nTest_java_io_SyncFailedException\nTest_java_lang_AbstractMethodError\nTest_java_lang_ArithmeticException\nTest_java_lang_ArrayIndexOutOfBoundsException\nTest_java_lang_ArrayStoreException\nTest_java_lang_Boolean\nTest_java_lang_Byte\nTest_java_lang_Character\nTest_java_lang_Class\nTest_java_lang_ClassCastException\nTest_java_lang_ClassCircularityError\nTest_java_lang_ClassFormatError\nTest_java_lang_ClassLoader\nTest_java_lang_ClassNotFoundException\nTest_java_lang_CloneNotSupportedException\nTest_java_lang_Double\nTest_java_lang_Error\nTest_java_lang_Exception\nTest_java_lang_ExceptionInInitializerError\nTest_java_lang_Float\nTest_java_lang_IllegalAccessError\nTest_java_lang_IllegalAccessException\nTest_java_lang_IllegalArgumentException\nTest_java_lang_IllegalMonitorStateException\nTest_java_lang_IllegalThreadStateException\nTest_java_lang_IncompatibleClassChangeError\nTest_java_lang_IndexOutOfBoundsException\nTest_java_lang_InstantiationError\nTest_java_lang_InstantiationException\nTest_java_lang_Integer\nTest_java_lang_InternalError\nTest_java_lang_InterruptedException\nTest_java_lang_LinkageError\nTest_java_lang_Long\nTest_java_lang_Math\nTest_java_lang_NegativeArraySizeException\nTest_java_lang_NoClassDefFoundError\nTest_java_lang_NoSuchFieldError\nTest_java_lang_NoSuchMethodError\nTest_java_lang_NullPointerException\nTest_java_lang_Number\nTest_java_lang_NumberFormatException\nTest_java_lang_Object\nTest_java_lang_OutOfMemoryError\nTest_java_lang_RuntimeException\nTest_java_lang_SecurityManager\nTest_java_lang_Short\nTest_java_lang_StackOverflowError\nTest_java_lang_String\nTest_java_lang_StringBuffer\nTest_java_lang_StringIndexOutOfBoundsException\nTest_java_lang_System\nTest_java_lang_Thread\nTest_java_lang_ThreadDeath\nTest_java_lang_ThreadGroup\nTest_java_lang_Throwable\nTest_java_lang_UnknownError\nTest_java_lang_UnsatisfiedLinkError\nTest_java_lang_VerifyError\nTest_java_lang_VirtualMachineError\nTest_java_lang_vm_Image\nTest_java_lang_vm_MemorySegment\nTest_java_lang_vm_ROMStoreException\nTest_java_lang_vm_VM\nTest_java_lang_Void\nTest_java_net_BindException\nTest_java_net_ConnectException\nTest_java_net_DatagramPacket\nTest_java_net_DatagramSocket\nTest_java_net_DatagramSocketImpl\nTest_java_net_InetAddress\nTest_java_net_NoRouteToHostException\nTest_java_net_PlainDatagramSocketImpl\nTest_java_net_PlainSocketImpl\nTest_java_net_Socket\nTest_java_net_SocketException\nTest_java_net_SocketImpl\nTest_java_net_SocketInputStream\nTest_java_net_SocketOutputStream\nTest_java_net_UnknownHostException\nTest_java_util_ArrayEnumerator\nTest_java_util_Date\nTest_java_util_EventObject\nTest_java_util_HashEnumerator\nTest_java_util_Hashtable\nTest_java_util_Properties\nTest_java_util_ResourceBundle\nTest_java_util_tm\nTest_java_util_Vector\n";
>> >
>> >         int count = 10000000;
>> >         long time = System.currentTimeMillis();
>> >         PushbackInputStream pis = new PushbackInputStream(
>> >                 new ByteArrayInputStream(fileString.getBytes()), 65535);
>> >         byte[] buf = new byte[100];
>> >         for (int i = 0; i < count; i++) {
>> >             try {
>> >                 pis.read(buf, 0, 100);
>> >                 pis.unread(buf, 0, 100);
>> >             } catch (IOException e) {
>> >                 // ignore
>> >             }
>> >         }
>> >
>> >         // output
>> >         time = System.currentTimeMillis() - time;
>> >
>> >         System.out.println("======================");
>> >         System.out.println("Invoke Count: " + count);
>> >         System.out.println("Total Time: " + time + "ms");
>> >     }
>> >
>> > I have test on Intel(R) Core(TM)2 Duo Cpu 2.4GHZ, 2.98GB Memory machine,
>> the
>> > result is as below:
>> > Harmony patch before: 3362 ms
>> > Harmony patched: 1312 ms
>> >
>> >
>>
>>
>>
>> --
>> С уважением,
>> Алексей Федотов,
>> ЗАО <<Телеком Экспресс>>
>>
>



-- 
Tony Wu
China Software Development Lab, IBM
Mime
View raw message