57f6b42313
When writing a dill file, certain things are written to the BufferedSink via addBytes. In the case where the BufferedSink currently has nothing buffered and is given a input that is deemed small, prior to this CL, the data was added directly to the underlying sink. As such a million _sink.addBytes([42]) in a row would make at least 900,000 (the buffer size is 100,000) calls to the underlying sink. For `new File(path).openWrite()` that takes a while. This CL fixes it by always buffering the small writes, reducing the number of calls to the underlying sink to 10 in the above case. Change-Id: I097f490d57b0a27b3175d6bb4ef513851acc503e Reviewed-on: https://dart-review.googlesource.com/41740 Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Commit-Queue: Jens Johansen <jensj@google.com>