Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: pkg/analysis_server/lib/src/services/index/store/split_store.dart

Issue 924943003: Use a slightly faster way to write index data. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/index/store/split_store.dart
diff --git a/pkg/analysis_server/lib/src/services/index/store/split_store.dart b/pkg/analysis_server/lib/src/services/index/store/split_store.dart
index fc1ca31616d9a87571296627fddb1db75f9af3d2..7e65c174d0d5d389e738d98320d9ac51bf3aad4c 100644
--- a/pkg/analysis_server/lib/src/services/index/store/split_store.dart
+++ b/pkg/analysis_server/lib/src/services/index/store/split_store.dart
@@ -6,7 +6,6 @@ library services.src.index.store.split_store;
import 'dart:async';
import 'dart:collection';
-import 'dart:io';
import 'dart:typed_data';
import 'package:analysis_server/src/services/index/index.dart';
@@ -988,7 +987,7 @@ class _DataInputStream {
}
int readInt() {
- int result = _byteData.getInt32(_byteOffset);
+ int result = _byteData.getInt32(_byteOffset, Endianness.HOST_ENDIAN);
_byteOffset += 4;
return result;
}
@@ -996,16 +995,23 @@ class _DataInputStream {
class _DataOutputStream {
- BytesBuilder _buffer = new BytesBuilder();
+ static const LIST_SIZE = 1024;
+ int _size = LIST_SIZE;
+ Uint32List _buf = new Uint32List(LIST_SIZE);
+ int _pos = 0;
Uint8List getBytes() {
- return new Uint8List.fromList(_buffer.takeBytes());
+ return new Uint8List.view(_buf.buffer, 0, _size << 2);
}
void writeInt(int value) {
- _buffer.addByte((value & 0xFF000000) >> 24);
- _buffer.addByte((value & 0x00FF0000) >> 16);
- _buffer.addByte((value & 0x0000FF00) >> 8);
- _buffer.addByte(value & 0xFF);
+ if (_pos == _size) {
+ int newSize = _size << 1;
+ Uint32List newBuf = new Uint32List(newSize);
+ newBuf.setRange(0, _size, _buf);
+ _size = newSize;
+ _buf = newBuf;
+ }
+ _buf[_pos++] = value;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698