Monthly Archives: December 2013

Miscellaneous

Why is Card Counting a Terrible Idea?

For the uninitiated, blackjack is a card game commonly played at casinos. Most blackjack players try to employ basic strategy in order to minimize their losses, which are typically anywhere between .3-2% of each bet. Typically you can play 50 hands/hour and you need to bet at least $5/hand, so that means that if you were to play without any deviations from basic strategy, in the long run you would lose between $1.50/hr and $10/hr.

Basic strategy only takes the cards on the table into account. There are advanced strategies that take every card that has been played into account. For example, if a lot of small cards have been played, but very few large cards have been played, it follows that a lot of large cards and only a few small cards remain. Card counting is a technique that looks at the cards that have been played in order to predict the cards that haven’t been played yet, and this information can give the player an advantage.

read more »

profiling

Profiling I/O-Bound Applications

The other day at work I wanted to run a quick performance test, but I didn’t want I/O to be a bottleneck. The typical solution here is to use a ramdisk, but in my case, I was dealing with very large files, so a ramdisk wouldn’t be big enough. In fact, I didn’t care about the output at all, so ideally I’d be able to write all output to /dev/null, but that wasn’t possible in this test (for example, the system will automatically append a file extension to your filename).

If I wanted to, I could have made a few code changes to get my test to work properly, but a little googling revealed nullfs, a FUSE file system which is supposed to be a big black hole, and it seemed like the perfect solution to my problem. I quickly found out it wasn’t:

read more »