Hi. I've noticed that DefaultStyledDocument has a slowness issue when
inserting text. Even if you subclass it and expose the faster method:
protected void insert(int offset, ElementSpec[] data)

the body of the method still uses a stringbuilder to append all char[]
inside of the data before actually inserting into the content.

This is because the only method for insertion in the default content
interface is:
public UndoableEdit insertString(int where, String str)

Now if there are going to be extension methods in java 8, it would be nice
to have a
public UndoableEdit insert(int where, int index, int length, char[] str)
default {
   return insert(where, new String(index, length, str);
}

with a adequate specialization in GapContent (that obviously doesn't call
the string version), and that that new method is used in the
protected void insert(int offset, ElementSpec[] data)
method (and where it makes sense)

Reply via email to