Uploaded image for project: 'Apache Apex Malhar'
  1. Apache Apex Malhar
  2. APEXMALHAR-2178

Unnecessary byte array copy in KryoSerializableStreamCodec

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

        public Slice toByteArray(T info)
        {
          ByteArrayOutputStream os = new ByteArrayOutputStream();
          Output output = new Output(os);
      
          kryo.writeClassAndObject(output, info);
          output.flush();
          return new Slice(os.toByteArray(), 0, os.toByteArray().length);
        }
      

      It is not necessary to call os.toByteArray().length as it will result in duplicate copy of the byte array.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vrozov Vlad Rozov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: