The problem with CO2 cartridges, as GG mentioned, is that you may to bring a few of them in case you flub up the patch or have problems with the cartridge themselves. One of our riding buddies brought 3 cartridges and got a flat. He emptied one cartridge into the atmosphere because he didn't seat the cartridge right on the valve stem. The other two cartridges were insufficient to inflate the tire.
Depending on how large your tire is, it may take between 6-10 16g cartridges to inflate a streetbike rear to over 30 psi. A dirtbike tire may only need 3-4 cartridges to get to 15 psi, which is enough to get home if you have a rim-lock. However, the rear tire on my streetbike calls for 42 psi and would need close to 20 cartridges to get to the manufacturer's recommended pressure.
While a single 16g cartridge is small enough, this is what a box of 20 cartridges look like.
Not as compact if you want to be self-sufficient on the road.
If I was using cartridges on a street-bike, I'd probably only use the minimum amount to fill it up so its was rideable to a gas station, but if you're far from civilization, then a pump or compressor is your better bet. I have a small Anti-Gravity compressor that fits in the palm of my hand. I'd estimate it's about the size of that box of 20 CO2 cartridges above, and it's multi-use instead of single-use, so this is the better option for me.
The drawback to a compressor is that you need to get access to the bike's battery to use the compressor, or you need to pre-wire a 12V SAE pigtail or cigarette lighter/powerlet outlet to power the compressor. Most newer bikes already have a pigtail pre-wired for trickle chargers, you just need to make sure the fuse and the gauge of the wire on the pigtail is rated high enough to handle the amperage draw of the compressor. Most compressors draw between 10-15A.
The compressors can get pretty compact, but the smaller the unit, the more time it takes to inflate a tire to the recommended pressure. And the smaller units also tend to overheat quicker, which means you might have to shut it off to allow it time to cool off, extending your inflation time.
If you don't want to mess with batteries and electricity, then a manual pump is your go-to. We use this one for dirt-biking, a Topeak Road Morph G:
Morph® technology in a road pump. Extra long barrel gives huge performance. Includes in-line gauge for perfect inflationevery time.
www.topeak.com
Ideal for smaller tires, it only takes 40-50 pumps to get a dirtbike rear tire from flat to about 25 psi. Also small enough to carry inside a hydration backpack.
TLDR:
CO2 cartridges
Pros: don't need any setup or pre-wiring
Cons: single use, may need to carry a lot of cartridges which means it could get bulky, use gloves when inflating - cartridges get freezing cold
Compressor
Pros: multi-use, can be compact, don't need manual labour to pump
Cons: needs a 12V source, the smaller the compressor, the longer it takes to inflate the tire, smaller units may overheat if left on for a long time and may need to be shut off to cool down.
Manual pump
Pros: multi-use, don't need any setup or pre-wiring, compact to carry
Cons: needs manual labour to pump, might take a long time and lots of elbow grease to inflate a larger rear tire