I learned a hard lesson today: to make Swift really fast you have to know what you’re doing. You can’t just slap some code together and expect it to be zippy without understanding some of how Swift was designed and how it works. There is a very good presentation by some of the team members that built Swift here. My initial takeaway was that it was important to finalize any classes you didn’t plan on subclassing, incrementally check the timing analyzer, and finally, employ whole module optimization.
This is a short post–just a TIL sort of thing. I had an issue today where the system Python was 2.6, but I needed to run a test on some code that used Python 2.7. After some jiggering I figured out how to test my Python 2.7 code. Rather that simply running,
I ran, instead,
/usr/local/bin/python2.7 /usr/bin/nosetests tests.py
Boom. Now we’re testing.
I use cURL quite a bit when debugging APIs and I found this neat trick for pretty-printing JSON output. Add the following line to your
alias json="python -m json.tool"
Then you can pipe your cURL output through your new
json tool and print everything nicely,
curl -g http://some.domain/api/call | json