vaeth / eix

eix can access Gentoo portage ebuild information and description very quickly (using a local cache). It can also be used to access information on installed packages, local settings, and local and external overlays, and informs about changes in the tree
GNU General Public License v2.0
166 stars 14 forks source link

Improve eix-update performance #78

Closed ghost closed 4 years ago

ghost commented 4 years ago

Use SSE2 instructions to improve performance of find_first_of() by about 40%, which in turn improves performance of eix-update by about 20%. In case the CPU/compiler does not support SSE2, this patch isn't causing a performance drop. If/when the performance of std::string::find_first_of() improves, the custom find_first_of() function can be removed. Tested with GCC 10.2.0 and clang 10.0.1.

Also add missing std::move to slightly improve performance.

Please merge. Thanks.

vaeth commented 4 years ago

Thanks. Will merge, although I will modify it somewhat: Hard-coding SSE2 usage into the binary is not nice since the binary then breaks if used on a non-SSE2 machine. I will add a corresponding configure flag (and a USE-flag in the ebuild).

ghost commented 4 years ago

Thanks. Will merge, although I will modify it somewhat: Hard-coding SSE2 usage into the binary is not nice since the binary then breaks if used on a non-SSE2 machine. I will add a corresponding configure flag (and a USE-flag in the ebuild).

Just a note: SSE2 is mandated by the x86-64 ISA, so a non-SSE2 machine basically means a 32-bit machine with a CPU released before year 2003.

vaeth commented 4 years ago

Thanks for the information. Anyway, that's what the USE=cpu_flags_x86_sse2 (CPU_FLAGS_X86="sse2") is for in gentoo. If not specified, defaulting to __SSE2__ is fine, but users should be able to override.