How To Install libtsl-hopscotch-map-dev on Ubuntu 20.04
Introduction
In this tutorial we learn how to install libtsl-hopscotch-map-dev on Ubuntu 20.04.
What is libtsl-hopscotch-map-dev
libtsl-hopscotch-map-dev is:
The hopscotch-map library is a C++ implementation of a fast hash map and hash set using open-addressing and hopscotch hashing to resolve collisions. It is a cache-friendly data structure offering better performances than
std::unordered_mapin most cases and is closely similar togoogle::dense_hash_mapwhile using less memory and providing more functionalities.
The library provides the following main classes: tsl::hopscotch_map,
tsl::hopscotch_set, tsl::hopscotch_pg_map and tsl::hopscotch_pg_set. The
first two are faster and use a power of two growth policy, the last two use a
prime growth policy instead and are able to cope better with a poor hash
function. Use the prime version if there is a chance of repeating patterns in
the lower bits of your hash (e.g. you are storing pointers with an identity
hash function).
In addition to these classes the library also provides tsl::bhopscotch_map,
tsl::bhopscotch_set, tsl::bhopscotch_pg_map and tsl::bhopscotch_pg_set.
These classes have an additional requirement for the key, it must be
LessThanComparable, but they provide a better asymptotic upper bound.
Nonetheless if you don’t have specific requirements (risk of hash DoS attacks),
tsl::hopscotch_map and tsl::hopscotch_set should be sufficient in most
cases and should be your default pick as they perform better in general.
There are three methods to install libtsl-hopscotch-map-dev on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.
Install libtsl-hopscotch-map-dev Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get update
After updating apt database, We can install libtsl-hopscotch-map-dev using apt-get by running the following command:
sudo apt-get -y install libtsl-hopscotch-map-dev
Install libtsl-hopscotch-map-dev Using apt
Update apt database with apt using the following command.
sudo apt update
After updating apt database, We can install libtsl-hopscotch-map-dev using apt by running the following command:
sudo apt -y install libtsl-hopscotch-map-dev
Install libtsl-hopscotch-map-dev Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.
sudo aptitude update
After updating apt database, We can install libtsl-hopscotch-map-dev using aptitude by running the following command:
sudo aptitude -y install libtsl-hopscotch-map-dev
How To Uninstall libtsl-hopscotch-map-dev on Ubuntu 20.04
To uninstall only the libtsl-hopscotch-map-dev package we can use the following command:
sudo apt-get remove libtsl-hopscotch-map-dev
Uninstall libtsl-hopscotch-map-dev And Its Dependencies
To uninstall libtsl-hopscotch-map-dev and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:
sudo apt-get -y autoremove libtsl-hopscotch-map-dev
Remove libtsl-hopscotch-map-dev Configurations and Data
To remove libtsl-hopscotch-map-dev configuration and data from Ubuntu 20.04 we can use the following command:
sudo apt-get -y purge libtsl-hopscotch-map-dev
Remove libtsl-hopscotch-map-dev configuration, data, and all of its dependencies
We can use the following command to remove libtsl-hopscotch-map-dev configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge libtsl-hopscotch-map-dev
References
Summary
In this tutorial we learn how to install libtsl-hopscotch-map-dev package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.