It is quite difficult to pinpoint exactly what the similarities between these two characters' melancholy could be. One could suggest that the similarities lie, first, in the fact that they share their sentiments with those close to them. Antonio speaks with Salarino and Salanio, while Portia confides in Nerissa. In both instances, the characters discuss their condition with their friends.
The difference lies in the fact that Antonio does not know why he is sad, while Portia knows precisely what the source of her sadness is, as she tells Nerissa:
O me, the word 'choose!' I may
neither choose whom I would nor refuse whom I
dislike; so is the will of a living daughter curbed
by the will of a dead father. . .
It also appears as if the depth of each character's misery is somehow similar. Both deem their melancholy as disturbingly unwelcome and unpleasant. The difference lies in the fact that Antonio cannot possibly have a solution for his sadness since he does not know what causes it, while Portia, to a certain extent, has hope for a solution. She dreams of Bassanio choosing the right casket. That would, obviously, bring an end to her despair, while for Antonio there seems to be no resolution, as he tells Gratiano:
I hold the world but as the world, Gratiano;
A stage where every man must play a part,
And mine a sad one.
In the end, Antonio's despair worsens due to the ensuing events in the play, whilst Portia's issue is resolved since Bassanio chooses the right casket and she marries him.