{} vs dict(...)

I just spent a few days of extensive profiling. I got to a point where I had to optimize code snippets so small, that I even looked at the performance impact of creating dictionaries.

I’m going to write a separate post about profiling,  optimization and the techniques I used to get 5x performance compared to the initial version.

First, I’ll give you a sneak peek: Using the dict(…) expression is 6 times more expensive than the regular {…} call.

Intrigued? Read this great post by Doug Hellmann