anchor.diff:    void writeStringTable(StringIndexer indexer) {
       _binaryOffsetForStringTable = getBufferOffset();
   
  +    // Containers for the utf8 encoded strings.
  +    final List<Uint8List> data = new List<Uint8List>();
  +    int totalLength = 0;
  +    const int minLength = 1 << 16;
  +    Uint8List buffer;
  +    int index = 0;
  +
       // Write the end offsets.
       writeUInt30(indexer.index.length);
  -    int endOffset = 0;
  -    List<List<int>> data =
  -        new List<List<int>>.filled(indexer.index.length, null);
  -    int i = 0;
  -    Utf8Encoder utf8Encoder = const Utf8Encoder();
       for (String key in indexer.index.keys) {
  -      List<int> utf8Bytes = utf8Encoder.convert(key);
  -      data[i] = utf8Bytes;
  -      endOffset += utf8Bytes.length;
  -      writeUInt30(endOffset);
  -      i++;
  +      if (key.isNotEmpty) {
  +        int requiredMinLength = key.length;
  +        int allocateMinLength = requiredMinLength * 3;
  +        int newIndex;
  +        while (true) {
  +          if (buffer == null || index + requiredMinLength >= buffer.length) {
  +            int newLength = minLength;
  +            if (allocateMinLength > newLength) newLength = allocateMinLength;
  +            if (buffer != null && index > 0) {
  +              data.add(new Uint8List.view(buffer.buffer, 0, index));
  +            }
  +            index = 0;
  +            buffer = new Uint8List(newLength);
  +          }
  +          newIndex = NotQuiteString.writeUtf8(buffer, index, key);
  +          if (newIndex != -1) break;
  +          requiredMinLength = allocateMinLength;
  +        }
  +        if (newIndex < 0) {
  +          // Utf8 encoding failed.
  +          if (buffer != null && index > 0) {
  +            data.add(new Uint8List.view(buffer.buffer, 0, index));
  +            buffer = null;
  +            index = 0;
  +          }
  +          List<int> converted = utf8.encoder.convert(key);
  +          data.add(converted);
  +          totalLength += converted.length;
  +        } else {
  +          totalLength += newIndex - index;
  +          index = newIndex;
  +        }
  +      }
  +      writeUInt30(totalLength);
  +    }
  +    if (buffer != null && index > 0) {
  +      data.add(Uint8List.view(buffer.buffer, 0, index));
       }
   
       // Write the UTF-8 encoded strings.
  -    for (var entry in data) {
  -      writeBytes(entry);
  +    for (int i = 0; i < data.length; ++i) {
  +      writeBytes(data[i]);
       }
     }
   
  
positive.code:               : null) ??
            new Source(<int>[], const <int>[]);
  
        writeByteList(utf8Encoder.convert(uri == null ? "" : "$uri"));
        writeByteList(source.source);
        List<int> lineStarts = source.lineStarts;
        writeUInt30(lineStarts.length);
  
negative.code: 
      // Write data.
      int i = 0;
      Uint8List buffer = new Uint8List(1 << 16);
      for (Uri uri in _sourceUriIndexer.index.keys) {
        index[i] = getBufferOffset();
        Source source = ((includeSources &&
  