-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81182d3
commit f1bf9ec
Showing
3 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ Images/ | |
build/ | ||
dist/ | ||
MANIFEST | ||
profile.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# author: Hua Liang [ Stupid ET ] | ||
# email: [email protected] | ||
# website: http://EverET.org | ||
# | ||
|
||
import os | ||
from EffectLab.Effect import * | ||
|
||
Effect.empty_color = (255, 255, 255, 255) | ||
|
||
if __name__ == '__main__': | ||
from timeit import Timer | ||
from functools import partial | ||
import cProfile | ||
|
||
img = Image.new("RGB", (100, 100)) | ||
wave = GlobalWaveEffect(1, 0.5) | ||
test = partial(wave, img) | ||
|
||
profile = False | ||
if profile: | ||
cProfile.run("test()", "profile.data") | ||
|
||
import pstats | ||
#创建Stats对象 | ||
p = pstats.Stats("profile.data") | ||
# p.strip_dirs().sort_stats(-1).print_stats() | ||
# p.strip_dirs().sort_stats("cumulative").print_stats() | ||
p.strip_dirs().sort_stats("time").print_stats() | ||
else: | ||
t = Timer('test()', 'from __main__ import test') | ||
N = 3 | ||
TIMES = 30 | ||
print sum(t.repeat(N, TIMES)) / N / TIMES * 1000, 'ms' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# author: Hua Liang [ Stupid ET ] | ||
# email: [email protected] | ||
# website: http://EverET.org | ||
# | ||
|
||
|
||
import os, time, string, random | ||
import autoreload | ||
import ImageChops | ||
|
@@ -92,12 +94,25 @@ def main(): | |
# main() | ||
from timeit import Timer | ||
from functools import partial | ||
import cProfile | ||
|
||
img = Image.new("RGB", (100, 100)) | ||
wave = GlobalWaveEffect(1, 0.5) | ||
test = partial(wave, img) | ||
|
||
t = Timer('test()', 'from __main__ import test') | ||
|
||
print sum(t.repeat(3, 100)) / 3 | ||
profile = False | ||
if profile: | ||
cProfile.run("test()", "profile.data") | ||
|
||
import pstats | ||
#创建Stats对象 | ||
p = pstats.Stats("profile.data") | ||
# p.strip_dirs().sort_stats(-1).print_stats() | ||
# p.strip_dirs().sort_stats("cumulative").print_stats() | ||
p.strip_dirs().sort_stats("time").print_stats() | ||
else: | ||
t = Timer('test()', 'from __main__ import test') | ||
N = 3 | ||
TIMES = 30 | ||
print sum(t.repeat(N, TIMES)) / N / TIMES * 1000, 'ms' | ||
|