Skip to content

Commit

Permalink
[perf] pertty some code
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Aug 17, 2024
1 parent 0fd4507 commit 4e0cf90
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphElement/GElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ CStatus GElement::checkSuitable() {

GElementPtrArr GElement::getDeepPath(CBool reverse) const {
GElementPtrArr path;
auto* cur = const_cast<GElementPtr>(this); // 这个是肯定可以转移的
auto* cur = const_cast<GElementPtr>(this);
while (cur) {
path.push_back(cur);
cur = cur->belong_;
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphElement/GElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class GElement : public GElementObject,
* 判断是否进入 yield状态。如果是的话,则等待恢复。未进入yield状态,则继续运行
* @return
*/
inline CVoid checkYield();
CVoid checkYield();

/**
* 判断当前元素,是否可以线性执行。默认返回true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ CVoid GDynamicEngine::analysisDagType(const GSortedGElementPtrSet& elements) {
if (total_element_arr_.empty()
|| (front_element_arr_.size() == 1 && total_element_arr_.size() - 1 == linked_size_)) {
/**
* 如果所有的信息中,只有一个是非linkable。则说明只有开头的那个是的,且只有一个开头
* 如果所有的信息中,只有一个是非linkable。则说明只有最后的那个是的,且只有一个开头
* 故,这里将其认定为一条 lineal 的情况
* ps: 只有一个或者没有 element的情况,也会被算到 ALL_SERIAL 中去
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ CStatus GStaticEngine::run() {
std::vector<std::future<CStatus>> futures;
GElementPtrArr macros;
for (auto* element : arr) {
if (element->isMacro()
&& CGRAPH_DEFAULT_BINDING_INDEX == element->getBindingIndex()) {
if (element->isMacro() && element->isDefaultBinding()) {
// 未绑定线程的微任务,直接放到 macros 中,减少线程切换
macros.emplace_back(element);
} else {
auto fut = thread_pool_->commit([element] {
return element->fatProcessor(CFunctionType::RUN);
}, element->getBindingIndex());
}, element->binding_index_);
futures.emplace_back(std::move(fut));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/UtilsCtrl/Container/USmallVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class USmallVector : public UtilsObject {

if (cur_index_ >= capacity_) {
// 插入超限的时候,开始扩容
CSize curCapacity = capacity_ + CAPACITY;
const CSize curCapacity = capacity_ + CAPACITY;
T* curData = new T[curCapacity];
CGRAPH_ASSERT_NOT_NULL_THROW_ERROR(curData)

Expand Down

0 comments on commit 4e0cf90

Please sign in to comment.