I have this set of functions in my Google Sheet to create a Bitly bitlink whenever data in a row is changed. While this does work, it seems really slow to me. Looking at the Execution transcript, it looks like the lag is happening when the script queries the Sheet:

2. Range.getValue() [10.186 seconds]

The total script execution takes 40 to 80 seconds. This seems longer than it should take. Is there a better way to do this that is faster? Should I somehow be combining/batching the Sheet queries?

Here is the code:

/*
* SETTINGS
*/

var bitlyToken = "abcdefghijklmnopqrstuvwxyz";
var logging = true;

/*
* FUNCTIONS
*/

function _(logMsg) {
if(logging) {
Logger.log(logMsg);
}
}

var bitlyRequest = "https://api-ssl.bitly.com/v3/shorten?format=txt&access_token=" + bitlyToken + "&longUrl=" + longUrl;
var options = {
'method': 'get'
};
try {
response = UrlFetchApp.fetch(bitlyRequest,options);
response = response.getContentText();
response = response.trim();
return response;
} catch(e) {
return false;
}
}

var options = {
'method': 'get'
};
try {
response = UrlFetchApp.fetch(bitlyRequest,options);
response = response.getContentText();
response = response.trim();
return response;
} catch(e) {
return false;
}
}

function onEdit(e){
var editedCell = e.range;
var rowEdited = editedCell.getRow();
var longUrl = encodeURIComponent(ss.getRange("L"+rowEdited).getValue());

_("longUrl: " + longUrl);
if(longUrl.length > 0) {