Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounding box and Speed #1472

Open
DerKleinePunk opened this issue Jul 16, 2023 · 2 comments
Open

Bounding box and Speed #1472

DerKleinePunk opened this issue Jul 16, 2023 · 2 comments
Labels
performance For issues regarding performance

Comments

@DerKleinePunk
Copy link

Bounding box hit rate for file nodes.dat is only 0% (1/116)
What can I do to remove this Warning ?

https://github.com/DerKleinePunk/SDL2GuiHelper/blob/master/src/gui/GUIMapview.cpp

I use the Cario Renderer in my SDL2 Gui Project.
I works bust the Rendering is not so smooth i will using it on Raspberrry

@Framstag
Copy link
Owner

Framstag commented Jul 22, 2023

H @DerKleinePunk. I was in holiday, so sorry for the late answer.

The warning comes from DataFIle.h.

  bool DataFile<N>::GetByOffset(IteratorIn begin, IteratorIn end,
                                size_t size,
                                const GeoBox& boundingBox,
                                std::vector<ValueType>& data) const

it is called by

  bool Database::GetNodesByOffset(const std::vector<FileOffset>& offsets,
                                  const GeoBox& boundingBox,
                                  std::vector<NodeRef>& nodes) const

which again it is called by

  bool MapService::GetNodes(const AreaSearchParameter& parameter,
                            const TypeInfoSet& nodeTypes,
                            const GeoBox& boundingBox,
                            bool prefill,
                            const TileRef& tile) const

The method gets a number of file offset from the index together with a bounding box (which is likely the visible map area). The warning means that most of the offsets returned by the index are actually not in the given area. This means that the index is too unspecific. It finds objects that are later on filtered out. This may be a performance penalty if IO is slow and CPU is fast. It is a hint that for this special area, the index should have possibly been generated with other parameters. If the warning comes only sporadically I would ignore it, if it often happens you can play with the parameters, but you have to measure if the new parameters are actually better (e.g. index with different parameters might require more memory or more IO during index lookup).

The AreaNodeIndex Generator has the following parameters:

  MagnificationLevel           areaNodeGridMag;          //<! Magnification level for the index grid
  uint16_t                     areaNodeSimpleListLimit;  //<! If a type has less entries, we just store them plain
  uint16_t                     areaNodeTileListLimit;    //<! If a type has less entries in a tile, we store it as list
  uint16_t                     areaNodeTileListCoordLimit;//<! If a type has less entries we store the coord in tile lists
  MagnificationLevel           areaNodeBitmapMaxMag;      //<! Maximum Magnification level for bitmap index
  uint16_t                     areaNodeBitmapLimit;       //<! All cells must have less entries for a given zoom level

with the following default values:

      areaNodeGridMag(14),
      areaNodeSimpleListLimit(500),
      areaNodeTileListLimit(100),
      areaNodeTileListCoordLimit(1000),
      areaNodeBitmapMaxMag(20),
      areaNodeBitmapLimit(20),

I would either start with increasing the GridMag to 15 or decrease the list limits by factor 2? I assume that the index file size will increase.

The Import application should have command line options for these. If one is missing that add it yourself or tell us (or change default value in your code). You have to regenerate the index after changing values.

@Framstag Framstag added the performance For issues regarding performance label Jul 22, 2023
@DerKleinePunk
Copy link
Author

I hope you Holiday are good.
Thanks I will Test it and Report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance For issues regarding performance
Projects
None yet
Development

No branches or pull requests

2 participants