Skip to content
Snippets Groups Projects
Commit 4886d18b authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Switch to std::uint_least32_t for stored indices in MatrixIndexSet

Using `std::uint_least32_t` instead of `std::size_t` halves the required memory
and thus also improves performance.
Notice that `std::uint32_t` is optional and `std::uint_fast32_t` is intended to be
fast in terms of computations and may have 64 bits. Here we're interested in reducing
memory and thus bandwith. Hence `std::uint_least32_t`, which is the smallest sufficient
type is most appropriate.
parent c8272a07
No related branches found
No related tags found
1 merge request!527Improve performance of MatrixIndexSet
......@@ -31,7 +31,7 @@ namespace Dune {
*/
class MatrixIndexSet
{
using Index = std::size_t;
using Index = std::uint_least32_t;
// A vector that partly mimics a std::set by staying
// sorted on insert() and having unique values.
......
......@@ -3,6 +3,7 @@
#ifndef DUNE_PYTHON_ISTL_BCRSMATRIX_HH
#define DUNE_PYTHON_ISTL_BCRSMATRIX_HH
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <string>
......@@ -29,7 +30,7 @@ namespace Dune
void registerMatrixIndexSet(pybind11::handle scope,
pybind11::class_<MatrixIndexSet, options...> cls)
{
typedef std::size_t size_type;
using size_type = Dune::MatrixIndexSet::size_type;
// two different possible constructors
cls.def( pybind11::init( [] () { return new MatrixIndexSet(); } ) );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment