In this section, we will compare the performance of sets and maps against their counterparts: arrays and objects. As mentioned in earlier chapters, the main goal of doing a comparison is not to know that the data structures are superior to their native counterparts but to understand their limitations and ensure that we make an informed decision when trying to use them.Â
It's very important to take benchmarks with a grain of salt. Benchmarking tools often use engines such as V8, which are built and optimized to run in a way that is very different from some other web-based engines. This may cause the results to be a little skewed based on the environment in which your application runs.
We will need to do some initial set up to run our performance benchmark. To create a Node.js project, go to a Terminal and run the following command:
mkdir performance...