diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-10-30 23:30:38 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-10-30 23:30:38 +0000 |
commit | 271a19ec191bf81d428c011909f37143da9cca36 (patch) | |
tree | c1af9d230446dd75c7d4dcc2d36de01b87cfda4e /benchmarks | |
parent | 2d2f0c0af37aaebeece1cdd37160f07d573ac6b8 (diff) |
Rewrite std::filesystem::path iterators and parser
This patch entirely rewrites the parsing logic for paths. Unlike the previous
implementation this one stores information about the current state; For example
if we are in a trailing separator or a root separator. This avoids the need for
extra lookahead (and extra work) when incrementing or decrementing an iterator.
Roughly this gives us a 15% speedup over the previous implementation.
Unfortunately this implementation is still a lot slower than libstdc++'s.
Because libstdc++ pre-parses and splits the path upon construction their
iterators are trivial to increment/decrement. This makes libc++ lazy parsing
100x slower than libstdc++. However the pre-parsing libstdc++ causes a ton
of extra and unneeded allocations when constructing the string. For example
`path("/foo/bar/")` would require at least 5 allocations with libstdc++
whereas libc++ uses only one. The non-allocating behavior is much preferable
when you consider filesystem usages like 'exists("/foo/bar/")'.
Even then libc++'s path seems to be twice as slow to simply construct compared
to libstdc++. More investigation is needed about this.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/CMakeLists.txt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index ed562e0cc..253fbd684 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -115,7 +115,8 @@ macro(add_benchmark_test name source_file) if (LIBCXX_BENCHMARK_NATIVE_STDLIB) set(native_target ${name}_native) add_executable(${native_target} EXCLUDE_FROM_ALL ${source_file}) - add_dependencies(${native_target} google-benchmark-native) + add_dependencies(${native_target} google-benchmark-native + google-benchmark-libcxx) target_link_libraries(${native_target} -lbenchmark) if (LIBCXX_BENCHMARK_NATIVE_STDLIB STREQUAL "libstdc++") target_link_libraries(${native_target} -lstdc++fs) |