/lic_test.py Secret
Created
June 26, 2014 07:30
license overhead
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
import timeit | |
#---------- SETUP | |
ntests= 10000 | |
#---------- CODE SNIPPETS | |
import_msk="import mosek\n" | |
setup_env_only="env=mosek.Env()\n" | |
setup_task_only="task=env.Task()\n" | |
solve_nothing= """\ | |
with mosek.Env() as env: | |
with env.Task () as task: | |
task.optimize() | |
""" | |
solve_nothing_w_task= """\ | |
with env.Task () as task: | |
task.optimize() | |
""" | |
#---------- RUNNIGN TESTS | |
print "-------------------------------------------------------------------------------------------------" | |
print "Running ",ntests," please wait..." | |
solve_nothing_t= timeit.timeit(stmt=solve_nothing,number=ntests,setup=import_msk) | |
print "avg. time for env+task+solve = ", solve_nothing_t/ntests," sec." | |
solve_nothing_w_task_t= timeit.timeit(stmt=solve_nothing_w_task,number=ntests,setup=import_msk+setup_env_only) | |
print "avg. time for task+solve for given env = ", solve_nothing_w_task_t/ntests," sec." | |
solve_nothing_w_task_env_t= timeit.timeit(stmt='task.optimize()',number=ntests,setup=import_msk+setup_env_only+setup_task_only) | |
print "avg. time for solve for given env and task = ", solve_nothing_w_task_env_t/ntests," sec." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment