summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2014-07-03 23:33:51 +0200
committerMichael Stapelberg <stapelberg@debian.org>2014-07-03 23:33:51 +0200
commit54e3c6fc82b4e59189ca6fa38547eb0f6d9034cc (patch)
tree25b3295c0d761a867c256122f0ba93e0230e8fd5
parent3b182a0624ad36b02564a3a5156ad08e29add62b (diff)
downloadgolang-54e3c6fc82b4e59189ca6fa38547eb0f6d9034cc.tar.gz
backport two patches to improve archive/tar performancedebian/2%1.3-2
-rw-r--r--debian/changelog5
-rw-r--r--debian/patches/0002-archive-tar-reuse-temporary-buffer-in-writeHeader.patch33
-rw-r--r--debian/patches/0003-archive-tar-reuse-temporary-buffer-in-readHeader.patch38
-rw-r--r--debian/patches/series2
4 files changed, 77 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 34b3dc073..8ce5e58fd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,8 +7,11 @@ golang (2:1.3-2) unstable; urgency=medium
deprecation warning about flet in the emacs part of golang-mode
(Closes: #753607)
* Migrate to emacsen >2 (Closes: #753607)
+ * Backport two patches to improve archive/tar performance (for docker):
+ debian/patches/0002-archive-tar-reuse-temporary-buffer-in-writeHeader.patch
+ debian/patches/0003-archive-tar-reuse-temporary-buffer-in-readHeader.patch
- -- Michael Stapelberg <stapelberg@debian.org> Thu, 03 Jul 2014 19:08:34 +0200
+ -- Michael Stapelberg <stapelberg@debian.org> Thu, 03 Jul 2014 23:33:46 +0200
golang (2:1.3-1) unstable; urgency=medium
diff --git a/debian/patches/0002-archive-tar-reuse-temporary-buffer-in-writeHeader.patch b/debian/patches/0002-archive-tar-reuse-temporary-buffer-in-writeHeader.patch
new file mode 100644
index 000000000..bd30f92a1
--- /dev/null
+++ b/debian/patches/0002-archive-tar-reuse-temporary-buffer-in-writeHeader.patch
@@ -0,0 +1,33 @@
+Description: archive/tar: reuse temporary buffer in writeHeader
+Author: Cristian Staretu <unclejacksons@gmail.com>
+Last-Update: 2014-07-03
+Forwarded: not-needed
+Origin: vendor, https://code.google.com/p/go/source/detail?r=837348e418f33fc7a242f56dbe2feff829532526#
+
+---
+
+diff -r c5f72a685e25 -r 837348e418f3 src/pkg/archive/tar/writer.go
+--- a/src/pkg/archive/tar/writer.go Wed Jul 02 15:28:57 2014 -0700
++++ b/src/pkg/archive/tar/writer.go Thu Jul 03 09:40:53 2014 +1000
+@@ -37,8 +37,9 @@
+ nb int64 // number of unwritten bytes for current file entry
+ pad int64 // amount of padding to write after current file entry
+ closed bool
+- usedBinary bool // whether the binary numeric field extension was used
+- preferPax bool // use pax header instead of binary numeric header
++ usedBinary bool // whether the binary numeric field extension was used
++ preferPax bool // use pax header instead of binary numeric header
++ hdrBuff [blockSize]byte // buffer to use in writeHeader
+ }
+
+ // NewWriter creates a new Writer writing to w.
+@@ -160,7 +161,8 @@
+ // subsecond time resolution, but for now let's just capture
+ // too long fields or non ascii characters
+
+- header := make([]byte, blockSize)
++ header := tw.hdrBuff[:]
++ copy(header, zeroBlock)
+ s := slicer(header)
+
+ // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax
diff --git a/debian/patches/0003-archive-tar-reuse-temporary-buffer-in-readHeader.patch b/debian/patches/0003-archive-tar-reuse-temporary-buffer-in-readHeader.patch
new file mode 100644
index 000000000..01da10797
--- /dev/null
+++ b/debian/patches/0003-archive-tar-reuse-temporary-buffer-in-readHeader.patch
@@ -0,0 +1,38 @@
+Description: archive/tar: reuse temporary buffer in readHeader
+Author: Cristian Staretu <unclejacksons@gmail.com>
+Last-Update: 2014-07-03
+Forwarded: not-needed
+Origin: vendor, https://code.google.com/p/go/source/detail?r=17404efd6b02d4b3acd17070e3f89de97a145877
+
+---
+
+diff -r 837348e418f3 -r 17404efd6b02 src/pkg/archive/tar/reader.go
+--- a/src/pkg/archive/tar/reader.go Thu Jul 03 09:40:53 2014 +1000
++++ b/src/pkg/archive/tar/reader.go Thu Jul 03 09:41:19 2014 +1000
+@@ -29,10 +29,11 @@
+ // The Next method advances to the next file in the archive (including the first),
+ // and then it can be treated as an io.Reader to access the file's data.
+ type Reader struct {
+- r io.Reader
+- err error
+- pad int64 // amount of padding (ignored) after current file entry
+- curr numBytesReader // reader for current file entry
++ r io.Reader
++ err error
++ pad int64 // amount of padding (ignored) after current file entry
++ curr numBytesReader // reader for current file entry
++ hdrBuff [blockSize]byte // buffer to use in readHeader
+ }
+
+ // A numBytesReader is an io.Reader with a numBytes method, returning the number
+@@ -426,7 +427,9 @@
+ }
+
+ func (tr *Reader) readHeader() *Header {
+- header := make([]byte, blockSize)
++ header := tr.hdrBuff[:]
++ copy(header, zeroBlock)
++
+ if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil {
+ return nil
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 411797591..0267a2ae4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
0001-backport-delete-whole-line.patch
+0002-archive-tar-reuse-temporary-buffer-in-writeHeader.patch
+0003-archive-tar-reuse-temporary-buffer-in-readHeader.patch