Making a selection in a dropdown based on several possible values
If speed is important, then you should avoid unnecessary dom lookups.
For example,
if sizeVal is not undefined, then you'll never need another dom lookup for sizeVal2.
You can rearrange the code accordingly:

    var sizeVal = $("#size option").filter(function() {
        return $(this).html() == sizePref;
    }).val();

    if (sizeVal !== undefined) {
        $("#size").val(sizeVal);
    } else {
        var sizeVal2 = $("#size option").filter(function() {
            return $(this).html() == "L";
        }).val();
        $("#size").val(sizeVal2);
    }


I would go even further an cache the $("#size option"),
and also move the repeated logic into a function:

var options = $("#size option");

function findSize(target) {
    options.filter(function() { return $(this).html() == target; });
}

var size = findSize(sizePref).val() || findSize("L").val();
var $("#size").val(size);