mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Another easy 15-20% by not searching with no references
This commit is contained in:
parent
e6a84c0cf0
commit
3ae31fadc3
|
@ -750,8 +750,7 @@ void cell::format(const class format new_format)
|
|||
format().d_->references -= format().d_->references > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
++new_format.d_->references;
|
||||
d_->format_ = new_format.d_;
|
||||
d_->format_ = detail::reference(new_format.d_);
|
||||
}
|
||||
|
||||
calendar cell::base_date() const
|
||||
|
|
|
@ -419,6 +419,7 @@ struct stylesheet
|
|||
if (pattern->references == 0)
|
||||
{
|
||||
*pattern = new_format;
|
||||
return pattern;
|
||||
}
|
||||
return find_or_create(new_format);
|
||||
}
|
||||
|
@ -431,6 +432,7 @@ struct stylesheet
|
|||
if (pattern->references == 0)
|
||||
{
|
||||
*pattern = new_format;
|
||||
return pattern;
|
||||
}
|
||||
return find_or_create(new_format);
|
||||
}
|
||||
|
@ -443,6 +445,7 @@ struct stylesheet
|
|||
if (pattern->references == 0)
|
||||
{
|
||||
*pattern = new_format;
|
||||
return pattern;
|
||||
}
|
||||
return find_or_create(new_format);
|
||||
}
|
||||
|
@ -455,6 +458,7 @@ struct stylesheet
|
|||
if (pattern->references == 0)
|
||||
{
|
||||
*pattern = new_format;
|
||||
return pattern;
|
||||
}
|
||||
return find_or_create(new_format);
|
||||
}
|
||||
|
@ -467,6 +471,7 @@ struct stylesheet
|
|||
if (pattern->references == 0)
|
||||
{
|
||||
*pattern = new_format;
|
||||
return pattern;
|
||||
}
|
||||
return find_or_create(new_format);
|
||||
}
|
||||
|
@ -483,6 +488,7 @@ struct stylesheet
|
|||
if (pattern->references == 0)
|
||||
{
|
||||
*pattern = new_format;
|
||||
return pattern;
|
||||
}
|
||||
return find_or_create(new_format);
|
||||
}
|
||||
|
@ -495,6 +501,7 @@ struct stylesheet
|
|||
if (pattern->references == 0)
|
||||
{
|
||||
*pattern = new_format;
|
||||
return pattern;
|
||||
}
|
||||
return find_or_create(new_format);
|
||||
}
|
||||
|
@ -577,5 +584,15 @@ struct stylesheet
|
|||
std::vector<color> colors;
|
||||
};
|
||||
|
||||
inline format_impl* reference(format_impl *impl)
|
||||
{
|
||||
++impl->references;
|
||||
if (impl->references == 1)
|
||||
{
|
||||
impl = impl->parent->find_or_create(*impl);
|
||||
}
|
||||
return impl;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace xlnt
|
||||
|
|
Loading…
Reference in New Issue
Block a user