Realisticly it is trial and error to find out what works best for you.
This can is simply by trying out different shafts on the same head and watching watch happens or going on to launch monitors to get comparison results, remembering it is not just about speed, but also height, distance and dispersion. E.g a lightweight shaft may just result in a higher shot without increasing distance, or just produce a hook.
The same shaft might well perform differently on different heads so is best carried on the club you intend to use.
Generally...the faster you swing the stiffer/heavier shaft but....
The adage " it's not how fast you swing it's how you swing it fast" is so true.
Weight is becoming slightly more important than flex...but trial and error is the only way in conjunction with a launch monitor