Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-481

Base64 to byte[] is not very efficient

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Version 2.5
    • Fix Version/s: None
    • Component/s: DOM
    • Labels:
      None

      Description

      We are using 30 mb large byte[] string represented as base64 binary type in shema and it is causing out of memory for us on server. Basically converting from base64 string to byte[] is not very efficient.

      JavaBase64Holder.java is using: vBytes = v.getBytes("UTF-8") and according to http://www.evanjones.ca/software/java-string-encoding-internals.html it uses base64 size * 4. In our case where there is 30mb large byte[] it uses around 160 mb just for converting string into byte[].

      Would it be possible to use v.getBytes("ASCII")? This would reduce the memory usage when converting from string to byte[] by 4 times.
      According to http://www.w3.org/TR/xmlschema-2/#base64Binary it should use only ASCII chars anyway.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              matej.spiller@siol.net Matej Spiller-Muys
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: