llvm-project/llvm
Fangrui Song cd93d7ef43 [llvm-exegesis] Clustering: don't enqueue a point multiple times
Summary:
SetVector uses both DenseSet and vector, which is time/memory inefficient. The points are represented as natural numbers so we can replace the DenseSet part by indexing into a vector<char> instead.

Don't cargo cult the pseudocode on the wikipedia DBSCAN page. This is a standard BFS style algorithm (the similar loops have been used several times in other LLVM components): every point is processed at most once, thus the queue has at most NumPoints elements. We represent it with a vector and allocate it outside of the loop to avoid allocation in the loop body.

We check `Processed[P]` to avoid enqueueing a point more than once, which also nicely saves us a `ClusterIdForPoint_[Q].isUndef()` check.

Many people hate the oneshot abstraction but some favor it, therefore we make a compromise, use a lambda to abstract away the neighbor adding process.

Delete the comment `assert(Neighbors.capacity() == (Points_.size() - 1));` as it is wrong.

llvm-svn: 350035
2018-12-23 20:48:52 +00:00
..
benchmarks
bindings
cmake Fix mingw build failures caused by r349839 2018-12-22 03:43:08 +00:00
docs ReleaseNotes: Document removal of add_llvm_loadable_module CMake macro 2018-12-21 16:20:37 +00:00
examples
include [ORC] Remove redundant instruction from MIPS resolver code. NFC 2018-12-23 12:04:55 +00:00
lib [DAGCombiner] limit shuffle to extend transform (PR40146) 2018-12-23 20:48:31 +00:00
projects [pstl] Initial integration with LLVM's CMake 2018-12-21 15:59:04 +00:00
resources
runtimes
test [DAGCombiner] limit shuffle to extend transform (PR40146) 2018-12-23 20:48:31 +00:00
tools [llvm-exegesis] Clustering: don't enqueue a point multiple times 2018-12-23 20:48:52 +00:00
unittests [llvm] API for encoding/decoding DWARF discriminators. 2018-12-21 22:48:50 +00:00
utils [gn build] Add build files for clang/tools/{arcmt-test,clang-check,clang-func-mapping} 2018-12-23 14:19:53 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt [CMake] Add libunwind when 'all' is being passed as LLVM_ENABLE_PROJECTS 2018-12-20 18:39:47 +00:00
CODE_OWNERS.TXT [llvm-mca] Move llvm-mca library to llvm/lib/MCA. 2018-12-17 08:08:31 +00:00
CREDITS.TXT add Kang Zhang(shkzhang@cn.ibm.com) to the CREDITS.TXT 2018-11-25 02:56:49 +00:00
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT Update the list of platforms & archs 2018-12-16 14:47:16 +00:00
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.