Tank size is irrelevant.
In my experience I've seen a huge difference in personality between the solitary betta and the betta with "friends"
Here is what I've found.
We will start with personality and fin types of the betta I've cared for and observed. These are the original personalities, observed while alone.
Haunter-Super Delta Docile/Finicky
Rick-Halfmoon Plakat Very Agressive
On to my observations in order.
Fishsticks was always a docile betta, more or less your average betta personality. Begging for food, didn't really flare unless put to a mirror or at another male in a split tank. Being docile when added to a 20 gallon community he was picked on. First by a solitary minnow, later by platys. Because he was being picked on he was moved to a 3 gallon heated critter keeper followed by a 5 gallon heated bowl. As a whole he always did better on his own. His large finaage prevented him from being aggressive. He would not defend himself from or pick on anything. For his benefit we moved him. He's much better off.
Haunter has always been afraid of everything. I've never once seen him flare. He was a rescue from pets mart. He had what looked like minor parasites. He was originally in a critter keeper until he got better. When he was better he took Fishsticks place in the community. He perked up in the community tank. He was picked on a little by the platys but by nothing else in the tank. Less than Fishsticks. When we removed him he seemed to get depressed laying around acting almost sick. We decided to move him back in the 20 which soon after became a 40 gallon. He is a community fish. He likes to grow around the platys and rasboras. He still has never once flared. Is a really docile friendly fish. He is afraid of just about everything. From fingers to the emerald cory's in the 40 gallon. He is less happy on his own though. He might just get bored easily.
Rick has just about always been my favorite betta. For the first 3 months I had him I kept him in a 2.5 gallon on my desk at school. He always attacked the sides and the solitary snail that munched on the small amount of algae on the walls. It was planted so I did a 50 percent water change a week. He is the only betta who I have been able to hand feed. He was aggressive to the point where he once jumped out of the water and bit my finger before diving to the bottom. He was originally in sand he used to burrow himself into the sand digging a small hole you sleep. Over the summer I moved him to a densely planted 10 gallon. I began to add other fish. I started with 3 scarlet badis, which he completely ignored. Followed by 10 red cherry shrimps which all but one were killed by both antibids overnight, the last fish I added were two stiphodon elegans they are the best algae eaters I have ever had and recommend them to anyone who has a densely planted tank with lots of hiding places. The only time I had any trouble with them was when I removed all the plants and most of the water to catch rick and the elegans to go to school. They are the hardest things in the world to net. Rick chased them around the tank until I moved him out. Keep in mind there was only about 3 inches of water in the tank and no plants or drift wood nor filter left. I don't think it was an aggression thing just more a territory thing. After rick was moved into the community he spent more time swimming around during the plants curious about everything. He still hand feeds but will no longer flare at my finger. They are also fed live food twice a week. He is okay in the community but he has had a large shift in personality.
T'ck is my sisters betta. He as always been in his own tank. Only with snails to accompany him. As a betta he is calm, but is a big piggy who lays on the bottom or hides in his cave until he notices you around. He the begs for food like no other betta I have ever seen. As a solitary betta he pays more attention to the people around him but I feel he is bored of his home. He was fin biting for awhile a few water changed and movement of his moss ball changed that. He shows some similar behaviors as Rick however he is much more tame. I am unsure if his personality would change in a community tank. His quality of life is the lowest of all the bettas I have cared for even temporarily. My sister is a but irresponsible and I'm not around enough to know if she is taking care of him. Thankfully my mother adopted him recently and he seems better. As for putting him in a community I feel he is the only fish who it would cause him to perish. He's already been through enough stress.
Last but not least there is Fishy my first betta. His community behavior has been the most strange. He is housed in a 10 Gallo with 3 false July cory's. Since switching to the community he has decided shrimp pellets are his favorite food. Something that is also shared by haunter. The difference is while haunter cleverly pick up the pellets and hides them, fishy lays on top of them until the Cory's lose interest. He then eats as much as he can and leaves the rest to the cory's. Being my largest betta, both in body and finnage this is pretty easy for him. This behavior has contributed to fin tears and personality changes. He is now much more antisocial towards human interaction and simply put often acts more like a Cory. He sleeps in the large foxtail in the middle of the tank and doesn't really do much unless the cory's are chasing each other or if it's time to eat.
I have no experience on betta living longer or shorter lives due to tank mates and all I can see is a major shift in personality, aggression, and behavior as a whole.
That's all the input I have on this subject.
If you have any question about rick's tank mates let me know I can answer most of them. I think cory's are a pain. And prefer heavily planted tanks.