There are many factors, all contributing to windward ability. Rig type, hull form, appendage configuration, etc. all play a role. If a slippery, canoe bodied hull was balanced for a Bermudian sloop, then converted to a conventionally proportioned gaffer of similar area, the gaffer would get killed to windward, by the Bermudian. This would be apples to apples (well almost), though not truly a fair test.
If two hulls were developed and both had highly refined versions of Bermudian or gaff rigs placed on them, each having a hull and appendages optimized for the specific rig it carried, then the gaffer would still get beat, but not nearly as badly and in some conditions could win to weather. This would mean a gaffer with internal halyards and every effort of reduced windage made, just like the Bermudian, a higher aspect ratio then typical proportions permit, very light spars, etc. Now this would be apples to apples and an interesting race, especially if long distance in deep water. This of course assumes that both boats are sailed perfectly, 100% of the time, with perfect sail cuts and sets, etc.