As I understand it, the "octane rating" of gasoline tells you how much the fuel can be compressed before it ignites spontaneously. This spontaneous ignition is called "knocking".
If you use too low an octane rated fuel in an engine that has a high compression rating, the fuel in the cylinder will spontaneously ignites on the compression stroke before the spark from the spark plug ignites it. You hear pinging or knocking. This can damage an engine.
Lower octane rated fuels can handle the least amount of compression before igniting, higher octane can handle more. It is the compression ratio of an engine that determines the octane rating of the gasoline to be used in that engine.
So if this is true, you could use the lowest octane rated fuel that does not result in knock, in any application, right?
This may not true in all cases, determining knock in a chainsaw may not be as easy as it is in a car, as many things affect what we may or may not perceive as knocking.
With this said, as a precaution, I always use a national brand, high octane gas in all my chainsaws. For a few cents more per gallon, it's cheap insurance.