diff --git a/ChangeLog b/ChangeLog index ef89f4ce..ed9fa8f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ # ChangeLog for eix - Ebuild IndeX for portage +*eix-0.34.9 + Jan Ziak <0xe2.0x9a.0x9b at gmail.com>: + - Use sse2 for speedup of eix-update. + *eix-0.34.8 Martin Väth : - Fix regression of 0.34.6 (and 0.34.5): Fix override_by_map. Thanks to diff --git a/config.h.in b/config.h.in index b36ab70d..bc5c082b 100644 --- a/config.h.in +++ b/config.h.in @@ -400,6 +400,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define if support for sse2 is wanted */ +#undef SUPPORT_SSE2 + /* Define if __attribute__ ((const)) can be used for const virtuals */ #undef USE_PURE_FOR_CONST_VIRTUALS diff --git a/configure.ac b/configure.ac index ffddad2c..f541743a 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,7 @@ dnl each item is listed in a separate line with indent level increased; dnl in such a case the opening/closing braces are isolated. dnl 2. The AC_INIT macro must be in one line since it is parsed by dnl primitive scripts. -AC_INIT([eix], [0.34.8], [https://github.com/vaeth/eix/issues/], [eix], [https://github.com/vaeth/eix/]) +AC_INIT([eix], [0.34.9], [https://github.com/vaeth/eix/issues/], [eix], [https://github.com/vaeth/eix/]) AC_PREREQ([2.64]) m4_ifdef([AC_CONFIG_MACRO_DIR], @@ -919,6 +919,8 @@ AC_ARG_WITH([extra-doc], [AS_VAR_SET([extra_doc], [false])]) AM_CONDITIONAL([EXTRA_DOC], [$extra_doc]) + + # Use paranoic asserts? AC_MSG_CHECKING([whether paranoic asserts are used]) AS_IF([$paranoicassert], @@ -1620,7 +1622,7 @@ AC_MSG_CHECKING([whether emplace can be used]) MV_RUN_IFELSE_LINK([AC_LANG_PROGRAM([[ #include #include - ]], [[ + ]], [[ typedef std::pair mypair; std::set a; a.insert(mypair(4, 4)); @@ -1632,6 +1634,31 @@ return (a.size() == 2) ? 0 : 1; [Define if STL has emplace])], [MV_MSG_RESULT([no])]) +# Check if sse2 can be used +AC_MSG_CHECKING([whether sse2 should be used]) +AS_VAR_SET([support_sse2], [false]) +AC_ARG_WITH([sse2], + [AS_HELP_STRING([--with-sse2], + [Use sse2 instruction set])], + [AS_CASE(["$withval"], + [no], [MV_MSG_RESULT([no], [on request])], + [MV_MSG_RESULT([yes], [on request]) + AS_VAR_SET([support_sse2], [:])])], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +]], [[ +#ifndef __SSE2__ +#error "SSE2 not available" +#endif + ]])], + [MV_MSG_RESULT([yes], [autodetected]) + AS_VAR_SET([support_sse2], [:])], + [MV_MSG_RESULT([no], [autodetected])])]) +AS_IF([$support_sse2], + [AC_DEFINE([SUPPORT_SSE2], + [1], + [Define if support for sse2 is wanted])]) + # reset the CXXFLAGS, LDFLAGS for the normal tests AS_VAR_COPY([CXXFLAGS], [my_cxxflags]) AS_VAR_COPY([LDFLAGS], [my_ldflags]) diff --git a/meson.build b/meson.build index 3841ef0e..459beaa0 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('eix', 'cpp', - version : '0.34.8', + version : '0.34.9', license : 'GPLv2', default_options : [ 'prefix=/usr', @@ -1370,6 +1370,24 @@ message('emplace: ' + have_emplace.to_string()) conf.set('HAVE_EMPLACE', have_emplace, description : 'Define if STL has emplace') +sse2 = get_option('sse2') +support_sse2 = false +sse2_msg = '' +if sse2 == 'auto' + sse2_msg = ' (auto)' + support_sse2 = cxx.compiles(''' +#include +#ifndef __SSE2__ +#error "SSE2 not available" +#endif +''', args : flags_dialect) +elif sse2 == 'true' + support_sse2 = true +endif +message('sse2: ' + support_sse2.to_string() + sse2_msg) +conf.set('SUPPORT_SSE2', support_sse2, + description : 'Define if support for sse2 is wanted') + sqlite_dep = [] with_sqlite = false want_sqlite = get_option('sqlite') @@ -1383,7 +1401,7 @@ if want_sqlite != 'false' sqlite_dep = [sqlite_only_dep] with_sqlite = true want_sqlite = 'true' - elif want_sqlite == true + elif want_sqlite == 'true' error('sqlite required by option but not found') else want_sqlite = 'false' diff --git a/meson_options.txt b/meson_options.txt index ffd00b98..d4268981 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -40,6 +40,8 @@ option('swap-remote', type : 'boolean', value : false, description : 'swap the remote paths') option('extra-doc', type : 'boolean', value : false, description : 'install developer documentation. Might need rst2html.py from docutils') +option('sse2', type : 'combo', choices : [ 'auto', 'true', 'false' ], + description : 'Compile in support for sse2') option('sqlite', type : 'combo', choices : [ 'auto', 'true', 'false' ], description : 'Compile in support for cache method sqlite') option('protobuf', type : 'combo', choices : [ 'auto', 'true', 'false' ], diff --git a/src/eixTk/stringlist.cc b/src/eixTk/stringlist.cc index dccf6fc1..a08cee34 100644 --- a/src/eixTk/stringlist.cc +++ b/src/eixTk/stringlist.cc @@ -101,6 +101,6 @@ void StringList::push_back(std::string&& s) { ptr->usage = 1; #endif } - ptr->push_back(std::move(s)); + ptr->push_back(MOVE(s)); } #endif diff --git a/src/eixTk/stringlist.h b/src/eixTk/stringlist.h index f8eccf98..29df1a0d 100644 --- a/src/eixTk/stringlist.h +++ b/src/eixTk/stringlist.h @@ -19,10 +19,8 @@ #include "eixTk/attribute.h" #ifdef STRINGLIST_FREE #include "eixTk/inttypes.h" -#ifdef HAVE_MOVE #include "eixTk/dialect.h" #endif -#endif #include "eixTk/diagnostics.h" #include "eixTk/null.h" #include "eixTk/stringtypes.h" @@ -65,7 +63,7 @@ class StringListContent { #ifdef HAVE_MOVE void push_back(std::string&& s) { - m_list.PUSH_BACK(std::move(s)); + m_list.PUSH_BACK(MOVE(s)); } #endif diff --git a/src/eixTk/stringutils.cc b/src/eixTk/stringutils.cc index 17001162..9c6518f7 100644 --- a/src/eixTk/stringutils.cc +++ b/src/eixTk/stringutils.cc @@ -12,6 +12,10 @@ #include +#ifdef SUPPORT_SSE2 +#include +#endif + #include #include @@ -30,9 +34,6 @@ #include "eixTk/null.h" #include "eixTk/stringtypes.h" -#ifdef __SSE2__ -#include -#endif using std::string; using std::vector; @@ -292,7 +293,7 @@ static void erase_escapes(string *s, const char *at) { } static string::size_type find_first_of(const string& str, const char *at, string::size_type pos, size_t at_len) { -#ifdef __SSE2__ +#ifdef SUPPORT_SSE2 const char *s = str.c_str(); const string::size_type str_size = str.size(); diff --git a/src/eixTk/stringutils.h b/src/eixTk/stringutils.h index 999a11bf..8051dd99 100644 --- a/src/eixTk/stringutils.h +++ b/src/eixTk/stringutils.h @@ -484,7 +484,7 @@ template inline static void push_back(std::vector *v, const T& e) } #ifdef HAVE_MOVE template inline static void push_back(std::vector *v, T&& e) { - v->PUSH_BACK(std::move(e)); + v->PUSH_BACK(MOVE(e)); } #endif @@ -496,7 +496,7 @@ template inline static void push_back(std::set *s, const T& e) { } #ifdef HAVE_MOVE template inline static void push_back(std::set *s, T&& e) { - s->INSERT(std::move(e)); + s->INSERT(MOVE(e)); } #endif @@ -509,7 +509,7 @@ template inline static void push_back(UNORDERED_SET *s, const T& } #ifdef HAVE_MOVE template inline static void push_back(UNORDERED_SET *s, T&& e) { - s->INSERT(std::move(e)); + s->INSERT(MOVE(e)); } #endif #endif // HAVE_UNORDERED_SET