Mercurial > hg
annotate contrib/wix/defines.wxi @ 26845:7a77ee434179
help: replace some str.split() calls by str.partition() or str.rpartition()
Since Python 2.5 str has new methods: partition and rpartition. They are more
specialized than the usual split and rsplit, and they sometimes convey the
intent of code better and also are a bit faster (faster than split/rsplit with
maxsplit specified). Let's use them in appropriate places for a small speedup.
Example performance (partition):
$ python -m timeit 'assert "apple|orange|banana".split("|")[0] == "apple"'
1000000 loops, best of 3: 0.376 usec per loop
$ python -m timeit 'assert "apple|orange|banana".split("|", 1)[0] == "apple"'
1000000 loops, best of 3: 0.327 usec per loop
$ python -m timeit 'assert "apple|orange|banana".partition("|")[0] == "apple"'
1000000 loops, best of 3: 0.214 usec per loop
Example performance (rpartition):
$ python -m timeit 'assert "apple|orange|banana".rsplit("|")[-1] == "banana"'
1000000 loops, best of 3: 0.372 usec per loop
$ python -m timeit 'assert "apple|orange|banana".rsplit("|", 1)[-1] == "banana"'
1000000 loops, best of 3: 0.332 usec per loop
$ python -m timeit 'assert "apple|orange|banana".rpartition("|")[-1] == "banana"'
1000000 loops, best of 3: 0.219 usec per loop
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 02 Nov 2015 23:37:14 +0800 |
parents | bd9bc4123920 |
children |
rev | line source |
---|---|
13042
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
1 <Include> |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
2 |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
3 <?if $(var.Platform) = "x64" ?> |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
4 <?define IsX64 = yes ?> |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
5 <?else?> |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
6 <?define IsX64 = no ?> |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
7 <?endif?> |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
8 |
bd9bc4123920
wix: add support for x64 native MSI packages
Steve Borho <steve@borho.org>
parents:
diff
changeset
|
9 </Include> |