aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-10 20:11:26 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-10 20:11:26 +0100
commit34969fdda92f5a5ea28ee980c5fe76e59039dbdf (patch)
tree2e2bbb333aa73483bc6df29aabe12014691eacd5
parent870ceb9a6b4a72aea7ff8be65a6c6e7ef83a683e (diff)
downloadpaludis-34969fdda92f5a5ea28ee980c5fe76e59039dbdf.tar.gz
paludis-34969fdda92f5a5ea28ee980c5fe76e59039dbdf.tar.xz
Selections cache doesn't make a huge difference, so kill
-rw-r--r--paludis/environment.hh21
-rw-r--r--paludis/environment_implementation.cc19
-rw-r--r--paludis/environment_implementation.hh6
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/selection_cache-fwd.hh29
-rw-r--r--paludis/selection_cache.cc99
-rw-r--r--paludis/selection_cache.hh60
-rw-r--r--src/clients/cave/resolve_common.cc2
8 files changed, 1 insertions, 236 deletions
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 16b1292..eec7e61 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -31,7 +31,6 @@
#include <paludis/package_id-fwd.hh>
#include <paludis/mask-fwd.hh>
#include <paludis/selection-fwd.hh>
-#include <paludis/selection_cache-fwd.hh>
#include <paludis/metadata_key_holder.hh>
#include <paludis/choice-fwd.hh>
#include <paludis/create_output_manager_info-fwd.hh>
@@ -382,26 +381,6 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
- * Add a selection cache.
- *
- * Probably only to be used by ScopedSelectionCache.
- *
- * \since 0.42
- */
- virtual void add_selection_cache(
- const std::shared_ptr<const SelectionCache> &) = 0;
-
- /**
- * Remove a selection cache registered using add_selection_cache.
- *
- * Probably only to be used by ScopedSelectionCache.
- *
- * \since 0.42
- */
- virtual void remove_selection_cache(
- const std::shared_ptr<const SelectionCache> &) = 0;
-
- /**
* Create a repository from a particular file.
*
* Does not add the repository to the Environment.
diff --git a/paludis/environment_implementation.cc b/paludis/environment_implementation.cc
index f4e6455..cfbec08 100644
--- a/paludis/environment_implementation.cc
+++ b/paludis/environment_implementation.cc
@@ -23,7 +23,6 @@
#include <paludis/hook.hh>
#include <paludis/distribution.hh>
#include <paludis/selection.hh>
-#include <paludis/selection_cache.hh>
#include <paludis/repository.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
@@ -128,7 +127,6 @@ namespace paludis
struct Imp<EnvironmentImplementation>
{
std::map<unsigned, NotifierCallbackFunction> notifier_callbacks;
- std::list<std::shared_ptr<const SelectionCache> > selection_caches;
std::list<std::shared_ptr<Repository> > repositories;
std::multimap<int, std::list<std::shared_ptr<Repository> >::iterator> repository_importances;
@@ -201,10 +199,7 @@ EnvironmentImplementation::is_paludis_package(const QualifiedPackageName & n) co
std::shared_ptr<PackageIDSequence>
EnvironmentImplementation::operator[] (const Selection & selection) const
{
- if (_imp->selection_caches.empty())
- return selection.perform_select(this);
- else
- return _imp->selection_caches.back()->perform_select(this, selection);
+ return selection.perform_select(this);
}
NotifierCallbackID
@@ -234,18 +229,6 @@ EnvironmentImplementation::trigger_notifier_callback(const NotifierCallbackEvent
}
void
-EnvironmentImplementation::add_selection_cache(const std::shared_ptr<const SelectionCache> & c)
-{
- _imp->selection_caches.push_back(c);
-}
-
-void
-EnvironmentImplementation::remove_selection_cache(const std::shared_ptr<const SelectionCache> & c)
-{
- _imp->selection_caches.remove(c);
-}
-
-void
EnvironmentImplementation::add_set(
const SetName & name,
const SetName & combined_name,
diff --git a/paludis/environment_implementation.hh b/paludis/environment_implementation.hh
index fd79e5d..c256ce0 100644
--- a/paludis/environment_implementation.hh
+++ b/paludis/environment_implementation.hh
@@ -105,12 +105,6 @@ namespace paludis
virtual const std::shared_ptr<const SetSpecTree> set(const SetName &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual void add_selection_cache(
- const std::shared_ptr<const SelectionCache> &);
-
- virtual void remove_selection_cache(
- const std::shared_ptr<const SelectionCache> &);
-
virtual void add_repository(int importance, const std::shared_ptr<Repository> &);
virtual const std::shared_ptr<const Repository> fetch_repository(const RepositoryName &) const
diff --git a/paludis/files.m4 b/paludis/files.m4
index 0eda506..97cd33b 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -86,7 +86,6 @@ add(`repository', `hh', `fwd', `cc', `se')
add(`repository_factory', `hh', `fwd', `cc')
add(`repository_name_cache', `hh', `cc', `gtest', `testscript')
add(`selection', `hh', `cc', `fwd', `gtest')
-add(`selection_cache', `hh', `cc', `fwd')
add(`selection_handler', `hh', `cc', `fwd')
add(`serialise', `hh', `cc', `fwd', `impl')
add(`set_file', `hh', `cc', `se', `gtest', `testscript')
diff --git a/paludis/selection_cache-fwd.hh b/paludis/selection_cache-fwd.hh
deleted file mode 100644
index d65971e..0000000
--- a/paludis/selection_cache-fwd.hh
+++ /dev/null
@@ -1,29 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2009 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_SELECTION_CACHE_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_SELECTION_CACHE_FWD_HH 1
-
-namespace paludis
-{
- struct SelectionCache;
- struct ScopedSelectionCache;
-}
-
-#endif
diff --git a/paludis/selection_cache.cc b/paludis/selection_cache.cc
deleted file mode 100644
index 56b6b93..0000000
--- a/paludis/selection_cache.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <paludis/selection_cache.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/mutex.hh>
-#include <paludis/util/sequence.hh>
-#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/wrapped_output_iterator.hh>
-#include <paludis/environment.hh>
-#include <paludis/selection.hh>
-#include <unordered_map>
-#include <algorithm>
-
-using namespace paludis;
-
-typedef std::unordered_map<std::string, std::shared_ptr<const PackageIDSequence> > Cache;
-
-namespace paludis
-{
- template <>
- struct Imp<SelectionCache>
- {
- mutable Mutex mutex;
- mutable Cache cache;
- };
-
- template <>
- struct Imp<ScopedSelectionCache>
- {
- Environment * const environment;
- const std::shared_ptr<SelectionCache> selection_cache;
-
- Imp(Environment * const e) :
- environment(e),
- selection_cache(std::make_shared<SelectionCache>())
- {
- }
- };
-}
-
-SelectionCache::SelectionCache() :
- _imp()
-{
-}
-
-SelectionCache::~SelectionCache()
-{
-}
-
-const std::shared_ptr<PackageIDSequence>
-SelectionCache::perform_select(const Environment * const env, const Selection & s) const
-{
- std::string ss(s.as_string());
- Cache::const_iterator i(_imp->cache.end());
-
- {
- Lock lock(_imp->mutex);
- i = _imp->cache.find(ss);
-
- if (_imp->cache.end() == i)
- i = _imp->cache.insert(std::make_pair(ss, s.perform_select(env))).first;
- }
-
- std::shared_ptr<PackageIDSequence> result(std::make_shared<PackageIDSequence>());
- std::copy(i->second->begin(), i->second->end(), result->back_inserter());
- return result;
-}
-
-ScopedSelectionCache::ScopedSelectionCache(Environment * const e) :
- _imp(e)
-{
- _imp->environment->add_selection_cache(_imp->selection_cache);
-}
-
-ScopedSelectionCache::~ScopedSelectionCache()
-{
- _imp->environment->remove_selection_cache(_imp->selection_cache);
-}
-
-template class Pimp<SelectionCache>;
-template class Pimp<ScopedSelectionCache>;
-
diff --git a/paludis/selection_cache.hh b/paludis/selection_cache.hh
deleted file mode 100644
index a648094..0000000
--- a/paludis/selection_cache.hh
+++ /dev/null
@@ -1,60 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_SELECTION_CACHE_HH
-#define PALUDIS_GUARD_PALUDIS_SELECTION_CACHE_HH 1
-
-#include <paludis/selection_cache-fwd.hh>
-#include <paludis/util/pimp.hh>
-#include <paludis/environment-fwd.hh>
-#include <paludis/selection-fwd.hh>
-#include <paludis/package_id-fwd.hh>
-#include <memory>
-
-namespace paludis
-{
- class PALUDIS_VISIBLE SelectionCache
- {
- private:
- Pimp<SelectionCache> _imp;
-
- public:
- SelectionCache();
- ~SelectionCache();
-
- const std::shared_ptr<PackageIDSequence> perform_select(
- const Environment * const,
- const Selection &) const PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- class PALUDIS_VISIBLE ScopedSelectionCache
- {
- private:
- Pimp<ScopedSelectionCache> _imp;
-
- public:
- ScopedSelectionCache(Environment * const);
- ~ScopedSelectionCache();
- };
-
- extern template class Pimp<SelectionCache>;
- extern template class Pimp<ScopedSelectionCache>;
-}
-
-#endif
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index 878b6bd..1b06e59 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -99,7 +99,6 @@
#include <paludis/notifier_callback.hh>
#include <paludis/environment.hh>
#include <paludis/serialise-impl.hh>
-#include <paludis/selection_cache.hh>
#include <paludis/package_id.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/metadata_key.hh>
@@ -1093,7 +1092,6 @@ paludis::cave::resolve_common(
n::remove_if_dependent_fn() = std::cref(remove_if_dependent_helper)
));
- ScopedSelectionCache selection_cache(env.get());
std::shared_ptr<Resolver> resolver(std::make_shared<Resolver>(env.get(), resolver_functions));
bool is_set(false);
std::shared_ptr<const Sequence<std::string> > targets_cleaned_up;