Update post meta is slow while saving post

Post saving took much time. I have action to save custom metas using update_post_meta

add_action( 'save_post_property', 'propertys_save' );
function propertys_save($id) {
    foreach($_POST['meta'] as $k = $v) {
        $time_start = microtime(true);
        update_post_meta($id,$k,$v);
        echo microtime(true) - $time_start
    }
}

and i get this average timing:

0.16451787948608

And if i call update_post_meta anywhere in another place (for example admin-ajax.php?action=123) it will take:

0.00014281272888184s

It's 1000 times faster... Is there any way to speed it up?

Topic wp-update-post Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.