Skip to content

Commit 2787145

Browse files
committed
Try to improve performance
1 parent dc23f77 commit 2787145

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

btypes_big_integer/src/main/cpp/BRelation.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class BRelation : public BObject {
386386

387387
BRelation domainForRelations() const {
388388
BRelation result = BRelation();
389-
for(const S elem : this->domain()) {
389+
for(const S& elem : this->domain()) {
390390
result = result._union(BRelation(elem));
391391
}
392392
return result;
@@ -422,7 +422,7 @@ class BRelation : public BObject {
422422

423423
BRelation rangeForRelations() const {
424424
BRelation result = BRelation();
425-
for(T elem : this->range()) {
425+
for(const T& elem : this->range()) {
426426
result = result._union(new BRelation((T) elem));
427427
}
428428
return result;
@@ -1120,7 +1120,7 @@ class BRelation : public BObject {
11201120

11211121
template<typename A1 = typename S::left_type, typename A2 = typename S::right_type>
11221122
BBoolean isPartial(const BRelation<A1, A2>& domain) const {
1123-
for(S element : this->domain()) {
1123+
for(const S& element : this->domain()) {
11241124
BTuple<A1, A2> elementAsTuple = (BTuple<A1, A2>) element;
11251125
const immer::set<A2, typename BSet<A2>::Hash, typename BSet<A2>::HashEqual>* rangePtr = domain.map.find(elementAsTuple.projection1());
11261126
if(rangePtr == nullptr) {
@@ -1188,7 +1188,7 @@ class BRelation : public BObject {
11881188

11891189
template<typename A1 = typename S::left_type, typename A2 = typename S::right_type>
11901190
BBoolean checkDomain(const BRelation<A1, A2>& domain) const {
1191-
for(S element : this->domain()) {
1191+
for(const S& element : this->domain()) {
11921192
BTuple<A1, A2> elementAsTuple = (BTuple<A1, A2>) element;
11931193
const immer::set<A2, typename BSet<A2>::Hash, typename BSet<A2>::HashEqual>* rangePtr = domain.map.find(elementAsTuple.projection1());
11941194
if(rangePtr == nullptr) {
@@ -1255,7 +1255,7 @@ class BRelation : public BObject {
12551255

12561256
template<typename A1 = typename T::left_type, typename A2 = typename T::right_type>
12571257
BBoolean checkRange(const BRelation<A1, A2>& range) const {
1258-
for(S element : this->range()) {
1258+
for(const S& element : this->range()) {
12591259
BTuple<A1, A2> elementAsTuple = (BTuple<A1, A2>) element;
12601260
const immer::set<A2, typename BSet<A2>::Hash, typename BSet<A2>::HashEqual>* rangeRangePtr = range.map.find(elementAsTuple.projection1());
12611261
if(rangeRangePtr == nullptr) {

btypes_primitives/src/main/cpp/BRelation.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class BRelation : public BObject {
388388

389389
BRelation domainForRelations() const {
390390
BRelation result = BRelation();
391-
for(const S elem : this->domain()) {
391+
for(const S& elem : this->domain()) {
392392
result = result._union(BRelation(elem));
393393
}
394394
return result;
@@ -424,7 +424,7 @@ class BRelation : public BObject {
424424

425425
BRelation rangeForRelations() const {
426426
BRelation result = BRelation();
427-
for(T elem : this->range()) {
427+
for(const T& elem : this->range()) {
428428
result = result._union(new BRelation((T) elem));
429429
}
430430
return result;
@@ -1120,7 +1120,7 @@ class BRelation : public BObject {
11201120

11211121
template<typename A1 = typename S::left_type, typename A2 = typename S::right_type>
11221122
BBoolean isPartial(const BRelation<A1, A2>& domain) const {
1123-
for(S element : this->domain()) {
1123+
for(const S& element : this->domain()) {
11241124
BTuple<A1, A2> elementAsTuple = (BTuple<A1, A2>) element;
11251125
const immer::set<A2, typename BSet<A2>::Hash, typename BSet<A2>::HashEqual>* rangePtr = domain.map.find(elementAsTuple.projection1());
11261126
if(rangePtr == nullptr) {
@@ -1187,7 +1187,7 @@ class BRelation : public BObject {
11871187

11881188
template<typename A1 = typename S::left_type, typename A2 = typename S::right_type>
11891189
BBoolean checkDomain(const BRelation<A1, A2>& domain) const {
1190-
for(S element : this->domain()) {
1190+
for(const S& element : this->domain()) {
11911191
BTuple<A1, A2> elementAsTuple = (BTuple<A1, A2>) element;
11921192
const immer::set<A2, typename BSet<A2>::Hash, typename BSet<A2>::HashEqual>* rangePtr = domain.map.find(elementAsTuple.projection1());
11931193
if(rangePtr == nullptr) {
@@ -1254,7 +1254,7 @@ class BRelation : public BObject {
12541254

12551255
template<typename A1 = typename T::left_type, typename A2 = typename T::right_type>
12561256
BBoolean checkRange(const BRelation<A1, A2>& range) const {
1257-
for(S element : this->range()) {
1257+
for(const S& element : this->range()) {
12581258
BTuple<A1, A2> elementAsTuple = (BTuple<A1, A2>) element;
12591259
const immer::set<A2, typename BSet<A2>::Hash, typename BSet<A2>::HashEqual>* rangeRangePtr = range.map.find(elementAsTuple.projection1());
12601260
if(rangeRangePtr == nullptr) {

0 commit comments

Comments
 (0)