Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #include <sys/socket.h> | |
| #include <sys/types.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> | |
| #include <netdb.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| #include <iostream> | |
| #include <stdarg.h> | |
| #include <stdio.h> | 
| # for more info: https://gist.github.com/1120938 | 
| - http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/ | |
| - http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration | |
| article’s settings: ("spec spec" took 17-23!sec) | |
| export RUBY_HEAP_MIN_SLOTS=1250000 | |
| export RUBY_HEAP_SLOTS_INCREMENT=100000 | |
| export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
| export RUBY_GC_MALLOC_LIMIT=30000000 | |
| export RUBY_HEAP_FREE_MIN=12500 | 
| # source: http://github.com/rtomayko/dotfiles/blob/rtomayko/.reerc | |
| # baseline REE environment settings for server environments | |
| # http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning | |
| ## ruby defaults | |
| # RUBY_HEAP_MIN_SLOTS=10000 | |
| # RUBY_HEAP_SLOTS_INCREMENT=10000 | |
| # RUBY_HEAP_SLOTS_GROWTH_FACTOR=1.8 | |
| # RUBY_GC_MALLOC_LIMIT=8000000 |