summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/poptions.cpp
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2020-06-13 15:49:35 +0200
committer couriersud <couriersud@gmx.org>2020-06-13 15:49:35 +0200
commite949e9c29de82ee7c32692e7b65da05dd22bdc9d (patch)
tree8770696a48827e3b63d94063f8162eaadeff6539 /src/lib/netlist/plib/poptions.cpp
parent75681d760c478f772fdb1603222498f96a9b61e7 (diff)
netlist: Performance improvement and refactoring. [Couriersud]
Kidniki now achieves up to 910% when run with static solvers and with nltool. That is significant better than the 860% we have seen previously. This increase is driven by using a global memory pool in the solver code. In addition the following refactoring and code maintenance work is included. Please excuse the large commit, some of this took interfered with other work and the detail development steps were ugly. - gsl support: This commit adds pgsl.h which implements a very limited number of the functionality of the gsl header described in the c++ core guidelines. - clang-tidy fixes - A significant refactoring of palloc.h. Aligned hints were removed, they added complexity without a significant performance gain. Vector operations should better be done on special spans/views. The code has been tested on linux with g++-7, g++-9, clang-11. On Windows mingw-10 and VS2019, OSX clang-11.
Diffstat (limited to 'src/lib/netlist/plib/poptions.cpp')
-rw-r--r--src/lib/netlist/plib/poptions.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/netlist/plib/poptions.cpp b/src/lib/netlist/plib/poptions.cpp
index 690feb38c61..c22076f6d0c 100644
--- a/src/lib/netlist/plib/poptions.cpp
+++ b/src/lib/netlist/plib/poptions.cpp
@@ -68,7 +68,7 @@ namespace plib {
auto *o = dynamic_cast<option *>(opt);
if (o != nullptr)
{
- if (o->short_opt() == "" && o->long_opt() == "")
+ if (o->short_opt().empty() && o->long_opt().empty())
{
auto *ov = dynamic_cast<option_args *>(o);
if (ov != nullptr)
@@ -103,7 +103,7 @@ namespace plib {
if (!seen_other_args && plib::startsWith(arg, "--"))
{
auto v = psplit(arg.substr(2),"=");
- if (!v.empty() && v[0] != "")
+ if (!v.empty() && !v[0].empty())
{
opt = getopt_long(v[0]);
has_equal_arg = (v.size() > 1);
@@ -210,11 +210,11 @@ namespace plib {
if (auto * const opt = dynamic_cast<option *>(optbase))
{
pstring line = "";
- if (opt->short_opt() != "")
+ if (!opt->short_opt().empty())
line += " -" + opt->short_opt();
- if (opt->long_opt() != "")
+ if (!opt->long_opt().empty())
{
- if (line != "")
+ if (!line.empty())
line += ", ";
else
line = " ";
@@ -248,7 +248,8 @@ namespace plib {
else if (auto *grp = dynamic_cast<option_group *>(optbase))
{
ret += "\n" + grp->group() + ":\n";
- if (grp->help() != "") ret += split_paragraphs(grp->help(), width, 4, 4) + "\n\n";
+ if (!grp->help().empty())
+ ret += split_paragraphs(grp->help(), width, 4, 4) + "\n\n";
}
}
// FIXME: other help ...
@@ -274,7 +275,7 @@ namespace plib {
for (const auto & optbase : m_opts)
{
auto *opt = dynamic_cast<option *>(optbase);
- if (opt != nullptr && arg != "" && opt->short_opt() == arg)
+ if (opt != nullptr && !arg.empty() && opt->short_opt() == arg)
return opt;
}
return nullptr;
@@ -284,7 +285,7 @@ namespace plib {
for (const auto & optbase : m_opts)
{
auto *opt = dynamic_cast<option *>(optbase);
- if (opt != nullptr && arg !="" && opt->long_opt() == arg)
+ if (opt != nullptr && !arg.empty() && opt->long_opt() == arg)
return opt;
}
return nullptr;