]> Cypherpunks repositories - gostls13.git/commit
bytes: encode size of rune read by ReadRune into lastRead to speed up UnreadRune
authorMartin Möhrmann <martisch@uos.de>
Tue, 6 Sep 2016 11:42:49 +0000 (13:42 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 17 Oct 2016 06:00:35 +0000 (06:00 +0000)
commit99df54f19696e26bea8d6a052d8d91ddb1e4ea65
treefa9e27a2dc1650dc839764864bb663fc29850753
parent1e775fe4a30c78cf6e8e995efe5a0f469b8d9a4d
bytes: encode size of rune read by ReadRune into lastRead to speed up UnreadRune

In ReadRune store the size of the rune that was read into lastRead
to avoid the need to call DecodeRuneLast in UnreadRune.

fmt:
name        old time/op  new time/op  delta
ScanInts-4   481µs ± 4%   458µs ± 3%  -4.64%  (p=0.000 n=20+20)

Change-Id: I500848e663a975f426402a4b3d27a541e5cac06c
Reviewed-on: https://go-review.googlesource.com/28817
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/bytes/buffer.go