You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/07/29 20:37:20 UTC
mesos git commit: Used `subtract` instead of `-=` for
`Resources::contains`.
Repository: mesos
Updated Branches:
refs/heads/master c8a9144dd -> 93d695959
Used `subtract` instead of `-=` for `Resources::contains`.
The current logic of `Resources::contains` is using `-=` to remove
the contained resource object and the `-=` resource object will
invoke `validate` which is not necessary as all of the resource
objects are valid.
The fix is to use `subtract` instead of `-=` for
`Resources::contains`, this can make sure there is no validation
and can improve performance of `Resources::contains` for resources
object.
Review: https://reviews.apache.org/r/50553/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/93d69595
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/93d69595
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/93d69595
Branch: refs/heads/master
Commit: 93d69595904e951e90b3a6e878fec04918231201
Parents: c8a9144
Author: Guangya Liu <gy...@gmail.com>
Authored: Fri Jul 29 13:36:35 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Fri Jul 29 13:36:35 2016 -0700
----------------------------------------------------------------------
src/common/resources.cpp | 2 +-
src/v1/resources.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/93d69595/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 3dbff24..1fe7909 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -827,7 +827,7 @@ bool Resources::contains(const Resources& that) const
return false;
}
- remaining -= resource;
+ remaining.subtract(resource);
}
return true;
http://git-wip-us.apache.org/repos/asf/mesos/blob/93d69595/src/v1/resources.cpp
----------------------------------------------------------------------
diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp
index 3c85dc8..c62bc35 100644
--- a/src/v1/resources.cpp
+++ b/src/v1/resources.cpp
@@ -830,7 +830,7 @@ bool Resources::contains(const Resources& that) const
return false;
}
- remaining -= resource;
+ remaining.subtract(resource);
}
return true;