summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/prg/nltool.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/prg/nltool.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/prg/nltool.cpp')
-rw-r--r--src/lib/netlist/prg/nltool.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp
index 10a6f19a454..a7eaa6927a9 100644
--- a/src/lib/netlist/prg/nltool.cpp
+++ b/src/lib/netlist/prg/nltool.cpp
@@ -206,7 +206,7 @@ public:
return stream_ptr(nullptr);
strm->imbue(std::locale::classic());
- return std::move(strm); // FIXME: for c++11 clang builds;
+ return strm;
}
private:
@@ -225,14 +225,14 @@ public:
netlist::host_arena::unique_ptr<plib::dynlib_base> static_solver_lib() const override
{
if (m_boostlib == "builtin")
- return netlist::host_arena::make_unique<plib::dynlib_static>(nl_static_solver_syms);
+ return plib::make_unique<plib::dynlib_static, netlist::host_arena>(nl_static_solver_syms);
if (m_boostlib == "generic")
- return netlist::host_arena::make_unique<plib::dynlib_static>(nullptr);
+ return plib::make_unique<plib::dynlib_static, netlist::host_arena>(nullptr);
if (NL_DISABLE_DYNAMIC_LOAD)
throw netlist::nl_exception("Dynamic library loading not supported due to project security concerns.");
//pstring libpath = plib::util::environment("NL_BOOSTLIB", plib::util::buildpath({".", "nlboost.so"}));
- return netlist::host_arena::make_unique<plib::dynlib>(m_boostlib);
+ return plib::make_unique<plib::dynlib, netlist::host_arena>(m_boostlib);
}
private:
@@ -245,7 +245,7 @@ class netlist_tool_t : public netlist::netlist_state_t
public:
netlist_tool_t(tool_app_t &app, const pstring &name, const pstring &boostlib)
- : netlist::netlist_state_t(name, netlist::host_arena::make_unique<netlist_tool_callbacks_t>(app, boostlib))
+ : netlist::netlist_state_t(name, plib::make_unique<netlist_tool_callbacks_t, netlist::host_arena>(app, boostlib))
{
}
@@ -364,13 +364,13 @@ struct input_t
case netlist::param_t::POINTER:
throw netlist::nl_exception(plib::pfmt("param {1} is not numeric\n")(m_param.param().name()));
case netlist::param_t::DOUBLE:
- static_cast<netlist::param_fp_t*>(&m_param.param())->set(m_value);
+ plib::downcast<netlist::param_fp_t &>(m_param.param()).set(m_value);
break;
case netlist::param_t::INTEGER:
- static_cast<netlist::param_int_t*>(&m_param.param())->set(static_cast<int>(m_value));
+ plib::downcast<netlist::param_int_t &>(m_param.param()).set(static_cast<int>(m_value));
break;
case netlist::param_t::LOGIC:
- static_cast<netlist::param_logic_t*>(&m_param.param())->set(static_cast<bool>(m_value));
+ plib::downcast<netlist::param_logic_t &>(m_param.param()).set(static_cast<bool>(m_value));
break;
}
}
@@ -383,7 +383,7 @@ struct input_t
static std::vector<input_t> read_input(const netlist::setup_t &setup, const pstring &fname)
{
std::vector<input_t> ret;
- if (fname != "")
+ if (!fname.empty())
{
plib::putf8_reader r = plib::putf8_reader(std::make_unique<plib::ifstream>(plib::filesystem::u8path(fname)));
if (r.stream().fail())
@@ -392,7 +392,7 @@ static std::vector<input_t> read_input(const netlist::setup_t &setup, const pstr
pstring l;
while (r.readline(l))
{
- if (l != "")
+ if (!l.empty())
{
input_t inp(setup, l);
ret.push_back(inp);
@@ -724,7 +724,7 @@ static doc_ext read_docsrc(const pstring &fname, const pstring &id)
if (plib::startsWith(l, "//-"))
{
l = plib::trim(l.substr(3));
- if (l != "")
+ if (!l.empty())
{
auto a(plib::psplit(l, ":", true));
if (a.empty() || (a.size() > 2))
@@ -821,7 +821,7 @@ void tool_app_t::header_entry(const netlist::factory::element_t *e)
avs += ", " + s.substr(1);
mac_out("// usage : " + e->name() + "(name" + vs + ")", false);
- if (avs != "")
+ if (!avs.empty())
mac_out("// auto connect: " + avs.substr(2), false);
mac_out("#define " + e->name() + "(...)");
@@ -945,7 +945,7 @@ void tool_app_t::create_docheader()
{
auto d(read_docsrc(e->source().file_name(), e->name()));
- if (d.id != "")
+ if (!d.id.empty())
{
pout("//! [{1} csynopsis]\n", e->name());
header_entry(e.get());
@@ -967,7 +967,7 @@ void tool_app_t::create_docheader()
{
//auto d(read_docsrc(e->source().file_name(), e->name()));
- if (d.id != "")
+ if (!d.id.empty())
{
poutprefix("///", "");
@@ -1020,7 +1020,7 @@ void tool_app_t::create_docheader()
poutprefix("///", "");
poutprefix("///", " @section {}_4 Function Table", d.id);
poutprefix("///", "");
- if (d.functiontable == "")
+ if (!d.functiontable.empty())
poutprefix("///", " Please refer to the datasheet.");
else
poutprefix("///", " {}", d.functiontable);