Speed up Custom Column

Maybe it's still worth adding these few lines.
If not then this might still be an example of what wowbagger suggested:

//storing already know dates for folders here
//this var needs to be outside of the column function in the global scope of the script
//the global scope of the script will last as long as the column is populated with values
//once this is done or aborted, the column/script will be re-initialized from scratch next 
//time it's busy for a period of time
var folderDates = {};
//caution: I'm unsure about what happens if columns are populated for two different
//folders/tabs at the same time, not sure if both folders/tabs share the same script
//context, which could unwantedly mix data in the caching variable.
//but: for folder dates this could actually be a welcome side-effect if mixing occurs.
function myColumnFunction(ColumnData){
	//..
	if (colName == 'Parent\'s Modified Date') {
			parentPath = DOpus.FSUtil.NewPath(ColumnData.item);
			parentPath.Parent();
			if (!folderDates[parentPath]) {
				parentItem = DOpus.FSUtil.GetItem(parentPath);
				modifiedDate = parentItem.modify_utc;	
				folderDates[parentPath] = modifiedDate;
			} else {
				modifiedDate = folderDates[parentPath];
			}
			ColumnData.value = modifiedDate;
	}
}
2 Likes