[orca] Replace "".join(["\x00"] * n) with much faster "\x00" * n.



commit 53c0dd58f2eae7a486907c51a1fa42bc9fcb3dac
Author: Mario Lang <mlang delysid org>
Date:   Mon Jun 6 01:52:54 2016 +0200

    Replace "".join(["\x00"] * n) with much faster "\x00" * n.
    
    timeit reports that the version involving join takes 0.723 usec while the
    simple version takes only 0.089 usec (with a multiplication factor of 40
    in both cases).

 src/orca/braille.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 34f2cbd..f14f1d0 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -327,8 +327,7 @@ class Region:
 
         # Create an empty mask.
         #
-        mask = ['\x00'] * maskSize
-        return "".join(mask)
+        return '\x00' * maskSize
 
     def repositionCursor(self):
         """Reposition the cursor offset for contracted mode.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]