astropy/astropy — pull request #506 by mdboom (2012-11-27 15:54:23+00:00)
Title: Short circuit unit parsing

This PR is in response to the coordinate benchmarking result in https://github.com/astropy/coordinates-benchmark/pull/13#issuecomment-10759026.

For simple unit strings that contain only the name of a single unit, this can be done with a simple dictionary lookup and not need to pull in all of the pyparsing machinery. This speeds up unit creation from 3ms to 13us on my machine.