document.getRange taking time

Hi,
I am using the following code to lock ref type fields in the document:

for (com.aspose.words.Field field : document.getRange().getFields()) {
    if (field.getType() == FieldType.FIELD_REF) {
        field.isLocked(true);
    }
}
document.updateFields();
document.updatePageLayout();

But this is taking 30+ seconds for a big document, is there any other efficient way to achieve this?

@minocha.daksh I am afraid there is no other more efficient way to achieve this. If possible, could you please attach the problematic document where the operation takes much time? We will check the issue on our side and provide you more information.