WIP: trying to enhance layout layer lookup performance.

This commit is contained in:
Matthias Koefferlein 2022-12-13 23:58:56 +01:00
parent ad27c9a51d
commit b1e78efcaa
3 changed files with 72 additions and 8 deletions

View File

@ -255,6 +255,65 @@ private:
bool m_insert;
};
// -----------------------------------------------------------------
// Implementation of the ProxyContextInfo class
ProxyContextInfo
ProxyContextInfo::deserialize (std::vector<std::string>::const_iterator from, std::vector<std::string>::const_iterator to)
{
ProxyContextInfo info;
for (std::vector<std::string>::const_iterator i = from; i != to; ++i) {
tl::Extractor ex (i->c_str ());
if (ex.test ("LIB=")) {
info.lib_name = ex.skip ();
} else if (ex.test ("P(")) {
std::pair<std::string, tl::Variant> vv;
ex.read_word_or_quoted (vv.first);
ex.test (")");
ex.test ("=");
ex.read (vv.second);
info.pcell_parameters.insert (vv);
} else if (ex.test ("PCELL=")) {
info.pcell_name = ex.skip ();
} else if (ex.test ("CELL=")) {
info.cell_name = ex.skip ();
}
}
return info;
}
void
ProxyContextInfo::serialize (std::vector<std::string> &strings)
{
if (! lib_name.empty ()) {
strings.push_back ("LIB=" + lib_name);
}
for (std::map<std::string, tl::Variant> ::const_iterator p = pcell_parameters.begin (); p != pcell_parameters.end (); ++p) {
strings.push_back ("P(" + tl::to_word_or_quoted_string (p->first) + ")=" + p->second.to_parsable_string ());
}
if (! pcell_name.empty ()) {
strings.push_back ("PCELL=" + pcell_name);
}
if (! cell_name.empty ()) {
strings.push_back ("CELL=" + cell_name);
}
}
// -----------------------------------------------------------------
// Implementation of the Layout class
@ -1823,12 +1882,6 @@ Layout::insert_layer (unsigned int index, const LayerProperties &props)
layer_properties_changed ();
}
unsigned int
Layout::get_layer (const db::LayerProperties &lp)
{
return m_layers.get_layer (lp);
}
unsigned int
Layout::insert_special_layer (const LayerProperties &props)
{

View File

@ -1644,7 +1644,18 @@ public:
* If there already is a layer matching the given properties, it's index will be
* returned. Otherwise a new layer with these properties is created.
*/
unsigned int get_layer (const db::LayerProperties &props);
unsigned int get_layer (const db::LayerProperties &props)
{
return m_layers.get_layer (props);
}
/**
* @brief Gets the layer with the given properties or -1 if such a layer does not exist
*/
int get_layer_maybe (const db::LayerProperties &props)
{
return m_layers.get_layer_maybe (props);
}
/**
* @brief Insert a new special layer with the given properties

View File

@ -185,7 +185,7 @@ public:
unsigned int get_layer (const db::LayerProperties &props);
/**
* @brief Gets or creates a layer with the given properties or -1 if such a layer does not exist.
* @brief Gets the layer with the given properties or -1 if such a layer does not exist.
*/
int get_layer_maybe (const db::LayerProperties &props);