From 171cdcc69d8d746c5dd750ab3502578246b694dc Mon Sep 17 00:00:00 2001 From: Venelin Stoykov Date: Fri, 18 Aug 2017 09:10:27 +0300 Subject: [PATCH] Microoptimization for singlebyte fonts (#84) Instead of list comprehension which will call a function to get the integer value of the bytes directly convert it to bytearray which is more optimal structure for storing list of bytes. --- pdfminer/pdffont.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdfminer/pdffont.py b/pdfminer/pdffont.py index 96da7c1..2a1c5f3 100644 --- a/pdfminer/pdffont.py +++ b/pdfminer/pdffont.py @@ -494,7 +494,7 @@ class PDFFont(object): return False def decode(self, bytes): - return [six.indexbytes(bytes, i) for i,_ in enumerate(bytes)] # map(ord, bytes) + return bytearray(bytes) # map(ord, bytes) def get_ascent(self): return self.ascent * self.vscale