Author Archives: freegnu

About freegnu

freegnu and other stuff too

Less locks more message queues!

I was reading a blog post RailGuard  about a creative interface for avoiding having to code explicit exception handling around locks. I left a tip. A couple decades ago I would have agreed that was the solution. I changed my mind … Continue reading

Posted in Uncategorized | Leave a comment

Numba

http://numba.continuim.io Numba is dead simple to get the full close to c/c++ performance improvements from dynamic compilation and works great after you have the prerequisites installed. Numba required python packages: argparse numpy llvm Now you can import numba and use … Continue reading

Posted in Uncategorized | Leave a comment

A Grain Of Salt

Originally posted on Bulldozer00's Blog:
Somehow, I stumbled upon an academic paper that compares programming language performance in the context of computing the results for a well-known, computationally dense, macro-economics problem: “the stochastic neoclassical growth model“. Since the results…

Posted in Uncategorized | Leave a comment

How to determine the performance hit of regular expressions

This coding example is really about how to figure out what is faster. In some cases regular expressions may be the optimal solution but as a rule of thumb they are suboptimal for the simpler cases. e.g. starts with, ends … Continue reading

Posted in programming, python | Leave a comment

Smarter last name first function

def last_first(name):   “””   Return last_name, first_name.   Checks for already reversed names.   Looks for some suffixes after the last name.   Only works with one part last names.   Leaves names like ‘Charles III’ as is.   “””   SUFFIXES = (‘jr’, ‘jnr’, ‘sr’, ‘snr’, … Continue reading

Posted in python | Tagged , , , | 1 Comment

Naive last name first function

def last_first(name):   “””   Return last_name, first_name.   Checks for already reversed names.   Assumes no suffix and one part last names.   “””   retval = name   if name and ‘,’ not in name:     parts = name.split()     retval = parts[-1] + ‘, ‘ + … Continue reading

Posted in python | Tagged , , , | Leave a comment

The digits of a number in reverse as a generator

def digits(n):   q, m = divmod(n, 10)   while q or m:     yield m     q, m = divmod(q, 10)

Posted in python | Tagged , , , | 1 Comment