Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4928268

performance optimization of UTF8 code in utf8.cpp

XMLWordPrintable

    • sparc
    • solaris_9

      ###@###.### 2003-09-25

      1. Taking a closer look at UTF8::unicode_length(), I see it is iterating a char * in order to count the number of characters.



      This in itself is relatively alright from a performance perspective, but it is doing so by call next(). The next() method is unnecessarily expensive to be used to simply count characters. I looked at this code in the past and came up with a prototype method called next_ptr that doesn't nothing else but find the pointer to the next character for quick iteration. I've attached my modified utf8.cpp file, it is based on mantis. Note, the code is a rough prototype, just view it as an idea to improve perf.


      2. convert_to_unicode can be optimized for the ASCII case. We've made similar changes in java library code and the code snip below is included in the attached file. The below loop is place before the loop calling next().
      ###@###.### 11/3/04 22:48 GMT

            Unassigned Unassigned
            ddkeenan David Keenan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: