Permalink
Browse files

Obscene performance hack, it works though!

  • Loading branch information...
1 parent 0138fb3 commit c7a52265b1dfee98e04609438acd85b1566561ea @alex committed Jun 22, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 markupsafe/_pypy_speedups.py
View
4 markupsafe/_pypy_speedups.py
@@ -34,7 +34,9 @@ def escape(s):
pass
else:
delta += d
- repls += bool(d)
+ # Obscene performance hack, d >> 2 returns 0 for 0 or 1 for 4 and 5
+ # which are the only values that can be here.
+ repls += d >> 2
i += 1
# Performance hack, can go away when PyPy's bridges are better
# optimized

0 comments on commit c7a5226

Please sign in to comment.