Commits

Mikhail Korobov committed 7fca224 Merge

Merge pull request #4 from dan-blanchard/master

Added iterkeys(), iteritems(), and iterprefixes()

  • Participants
  • Parent commits 1feb392, e53f7ec

Comments (0)

Files changed (16)

File bench/speed.py

                     runs=3
                 )
 
+        for meth in ['iterprefixes']:
+            for name, data in _bench_data:
+                bench(
+                    '%s.%s (%s)' % (struct_name, meth, name),
+                    timeit.Timer(
+                        "for word in %s:\n"
+                        "   list(data.%s(word))" % (data, meth),
+                        setup
+                    ),
+                    runs=3
+                )
+
         # keys with a given prefix
         _bench_data = [
             ('xxx', 'avg_len(res)==415', 'PREFIXES_3_1k'),
                     op_count=1,
                     runs=3
                 )
+            for meth in ['iterkeys', 'iteritems']:
+                bench(
+                    '%s.%s(prefix="%s"), %s' % (struct_name, meth, xxx, avg),
+                    timeit.Timer(
+                        "for word in %s: list(data.%s(word))" % (data, meth),
+                        setup
+                    ),
+                    'K ops/sec',
+                    op_count=1,
+                    runs=3
+                )
+
 
 def check_dawg(trie, words):
     value = 0

File src/_base_types.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_completer.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_dawg.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_dawg_builder.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_dictionary.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_dictionary_builder.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_dictionary_unit.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_guide.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_guide_builder.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/_guide_unit.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"

File src/b64_decode.cpp

-/* Generated by Cython 0.17 on Mon Sep 24 02:24:43 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 15:25:25 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"