Skip to content

Instantly share code, notes, and snippets.

View pablito56's full-sized avatar

Pablo E pablito56

View GitHub Profile
@pablito56
pablito56 / check_forbidden.py
Created May 17, 2013 09:41
Performance comparisson of different options to check existence of forbidden symbols in incoming strings (standard 'char in string' vs. RegExp).
#!/usr/bin/env python
#-*- coding: utf-8 -*-
u"""
Created on May 15, 2013
@author: pablito56
@license: MIT
@contact: pablito56@gmail.com
@pablito56
pablito56 / memoize_benchmark_gens.py
Created February 20, 2014 18:43
Benchmarking the use of memoize for regular expression transformations and generators. Based on https://gist.github.com/drslump/9109647
#!/usr/bin/env python
def memoize(fn):
""" Memoization decorator for a function taking one or more arguments.
NOTE: Only hashable values can be given as arguments to the function.
http://code.activestate.com/recipes/578231-probably-the-fastest-memoization-decorator-in-the-/#c4
"""
class memodict(dict):
@pablito56
pablito56 / collections_count.py
Last active August 29, 2015 13:57
MongoDB collections creation timing
#!/usr/bin/env python2.7
#-*- coding: utf-8 -*-
#
# Authors:
#    Pablo Enfedaque <pev@tid.es> - 2014
#
"""
Performance comparison of MongoDB operations
"""