Skip to content

Self-built containers may be needed to reduce memory cost #2573

@kirk0830

Description

@kirk0830

Describe Current Status and Possible Solution

Background

  1. Many data are stored in HTML-formatted file, for example the coefficients of spherical bessel function bessel_basis.cpp:line 337. To access data with higher efficiency, rather than search for data in certain line with time complexity O(N^2), HTML parser with mapping strategy will be a good choice.
  2. In input module, the way to parse INPUT file now is still the one-by-one strcmp method. Map can also be used here to reach a at least O(N^2) to O(NlogN) speed-up.

Problem

the C++ STL has non-negligible extra memory cost (including std::vector, std::map, etc), this will bring about unexpected memory cost problem to the overall program. To reproduce, use the toy HTML parser I write to parse UPF-formatted pseudopotential file. Although in principle the speed of accessing data will be higher, but memory cost now is terribly high.
html_parser.zip

Possible solution

Build containers by ourselves, so as to avoid extra memory cost by redundant functions and data.

Additional Context

No response

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions