I am just the sort of person who has to run a benchmark. Rate brett joe ross brett 21427/s -- -13% -41% joe 24594/s 15% -- -32% ross 36232/s 69% 47% -- Rate brett joe ross brett 18325/s -- -3% -41% joe 18976/s 4% -- -39% ross 31211/s 70% 64% -- Rate brett joe ross brett 26376/s -- -17% -52% joe 31963/s 21% -- -42% ross 55493/s 110% 74% -- Rate joe brett ross joe 10175/s -- -18% -51% brett 12375/s 22% -- -40% ross 20613/s 103% 67% -- It looks like the simple if based switch cleans the other methods clocks. That being said, Joe's makes it easy to add new keys and to alias keys (type and item_type can both point to $item), but the keys for this function are already written in stone (the Gtk API). I can't see a reason not to use the fastest function in this case (since there will be little to no maintenance).
Attachment:
bench.pl
Description: Binary data