summaryrefslogtreecommitdiff
path: root/weave/examples/print_example.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2005-09-26 20:20:16 +0000
committerTravis Oliphant <oliphant@enthought.com>2005-09-26 20:20:16 +0000
commit45d01a4be1c4221132ba46d687e6af3a8df3329b (patch)
treece3be5290e918def7c7187e747c5460193b0ca85 /weave/examples/print_example.py
parentccd1c3db37672627aa4fe0fdb5437f5dddc0fe86 (diff)
downloadnumpy-45d01a4be1c4221132ba46d687e6af3a8df3329b.tar.gz
Moved weave
Diffstat (limited to 'weave/examples/print_example.py')
-rw-r--r--weave/examples/print_example.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/weave/examples/print_example.py b/weave/examples/print_example.py
deleted file mode 100644
index 4a0338983..000000000
--- a/weave/examples/print_example.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import sys
-sys.path.insert(0,'..')
-import inline_tools
-
-import time
-
-def print_compare(n):
- print 'Printing %d integers:'%n
- t1 = time.time()
- for i in range(n):
- print i,
- t2 = time.time()
- py = (t2-t1)
-
- # get it in cache
- inline_tools.inline('printf("%d",i);',['i'])
- t1 = time.time()
- for i in range(n):
- inline_tools.inline('printf("%d",i);',['i'])
- t2 = time.time()
- print ' speed in python:', py
- print ' speed in c:',(t2 - t1)
- print ' speed up: %3.2f' % (py/(t2-t1))
-
-def cout_example(lst):
- # get it in cache
- i = lst[0]
- inline_tools.inline('std::cout << i << std::endl;',['i'])
- t1 = time.time()
- for i in lst:
- inline_tools.inline('std::cout << i << std::endl;',['i'])
- t2 = time.time()
-
-if __name__ == "__main__":
- n = 3000
- print_compare(n)
- print "calling cout with integers:"
- cout_example([1,2,3])
- print "calling cout with strings:"
- cout_example(['a','bb', 'ccc']) \ No newline at end of file