fast-osmpbf
A high-performance Rust library for reading OpenStreetMap files (*.osm.pbf). This library is focused on performance and provides pretty high-level data. if you need some lower level metadata, you might want to check out other libraries such as osmpbf.
Benchmarks
- CPU: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
- Memory: 16GB
- OS: Linux (Ubuntu)
- Dataset:
germany-latest.osm.pbf(~4.6GB)
Hyperfine was used to benchmark with 10 runs each.
What you see here is the mean time of these 10 runs.
All problems were run using parallelization if the library offered a way to do it.
| Problem | fast-osmpbf | osmpbf | osmpbfreader |
|---|---|---|---|
| Count ways | 13.51 s | 19.06 s | 39.58 s |
| Count addresses | 15.33 s | 21.70 s | 45.45 s |
Examples
- Count ways. We can (but dont have to) apply an element filter beforehand. Saves a little bit of computation.
use *;
- Count elements that have full addresses. We apply a filter on tags beforehand. This filter does not only filtering on tags, it actually speeds up computing by using a cache. If you iterate over tags and you know you only need certain tags, apply the filter beforehand.
use *;
use *;
License
This project is licensed under
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)