I prefer to board early and get settled as earlier posters have stated, but it depends on local knowledge and previous experiences depending on the carrier and airport.
I would normally aim to get to the gate between 5 and 10 mins after boarding has started to avoid queues in priority boarding lane (not that that always works) and try not to arrive later than 10 to 15 mins before gate closes.
Everyone is different though and I do tend to factor in walking time and distance from lounge.
Previous experience with emirates in Bangkok for example has resulted in me sitting in a crowded gate area for 20 mins plus so I tend to leave 10 mins after they announce flight ready to board, much nicer to board when direct from the lounge