aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-12 13:53:46 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-12 13:53:46 +0000
commitfc8698f50181d98a06cad43a6338e50ca32fa81a (patch)
tree90a877056af3d7737f30b2c638b98bb9b14dbe25
parent9e34f597072176ba2a59c4b3e8cd92af90c54807 (diff)
downloadpaludis-fc8698f50181d98a06cad43a6338e50ca32fa81a.tar.gz
paludis-fc8698f50181d98a06cad43a6338e50ca32fa81a.tar.xz
Use compare rather than operator< for sr comparisons where appropriate. Our cpv comparisons are now approximately three million six hundred and twenty five thousand two hundred and seven times faster than pkgcore's.
-rwxr-xr-xmisc/make_sr.bash13
-rw-r--r--paludis/default_config.cc2
-rw-r--r--paludis/name.cc1
-rw-r--r--paludis/package_database.cc1
-rw-r--r--paludis/version_spec.cc1
5 files changed, 14 insertions, 4 deletions
diff --git a/misc/make_sr.bash b/misc/make_sr.bash
index e932f00..01d692b 100755
--- a/misc/make_sr.bash
+++ b/misc/make_sr.bash
@@ -467,10 +467,15 @@ while read a ; do
echo "${a}::compare(const ${a} & other) const"
echo "{"
for (( k = 0 ; k < ${#want_comparison_fields[@]} ; k++ )) ; do
- echo " if (${want_comparison_fields[${k}]} < other.${want_comparison_fields[${k}]})"
- echo " return -1;"
- echo " if (${want_comparison_fields[${k}]} > other.${want_comparison_fields[${k}]})"
- echo " return 1;"
+ w=${want_comparison_fields[${k}]}
+ echo " switch (paludis::compare(${w}, other.${w}))"
+ echo " {"
+ echo " case -1:"
+ echo " return -1;"
+ echo " case 1:"
+ echo " return 1;"
+ echo " }"
+ echo
done
echo " return 0;"
echo "}"
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index b33b6f2..f13e200 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -20,6 +20,7 @@
#include <paludis/config_file.hh>
#include <paludis/default_config.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/compare.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/iterator.hh>
@@ -27,6 +28,7 @@
#include <paludis/util/is_file_with_extension.hh>
#include <paludis/util/log.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/sr.hh>
#include <paludis/util/system.hh>
#include <paludis/util/tokeniser.hh>
diff --git a/paludis/name.cc b/paludis/name.cc
index c42cdeb..8ff772d 100644
--- a/paludis/name.cc
+++ b/paludis/name.cc
@@ -19,6 +19,7 @@
#include <paludis/name.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/compare.hh>
#include <ostream>
/** \file
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 43a16d7..cd0bd21 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -23,6 +23,7 @@
#include <paludis/util/iterator.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/compare.hh>
#include <list>
#include <map>
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 326e216..6da3c73 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -18,6 +18,7 @@
*/
#include <algorithm>
+#include <paludis/util/compare.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
#include <paludis/version_spec.hh>