See the source for an answer to your question. It contains this line:
$ying = sprintf("%*.*s", -$y_length, $y_length, $ying);
So $y_length
is being used to reformat the strings, padding them if necessary and trimming them to an identical length. These equal-length strings are then fed into the actual comparison function. This suggests that Alex is correct and giving a length of max(length $ying, length $yang)
is going to give the best results under most circumstances.
Reading the source also reveals that if you fail to supply $y_length
, no default is supplied. So you'll be comparing the empty string to the empty string. Those should have a pretty short JW distance.