Coder Social home page Coder Social logo

cpp_optimizations_diary's Introduction

About me ๐Ÿ‘‹

Things I love:

  • Robotics: when I was a child, I wanted to build robots. This is what I do eventually so... success!
  • C++ Programming: I think I am quite good at it. This is called "Dunning Kruger effect".
  • Open Source: I have few projects going on, mostly related to robotics. I like reporting bugs and sending PRs titled "Improved performance x%".

Davide's github stats

cpp_optimizations_diary's People

Contributors

andre-nguyen avatar awesomebytes avatar facontidavide avatar golxzn avatar imgbotapp avatar nkhedekar avatar rgongw0414 avatar stevencolinmartin avatar zmk5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cpp_optimizations_diary's Issues

Small vectors - std::array?

Hi Davide, thanks for your excellent writeups!

I was just reading the small vector document, and all the time I was thinking: "He's gonna reveal std::array". But you did not. Have I misunderstood something, or is std::array really a "standard solution" to your StaticVector class?

## StaticVector and SmallVector in the wild

Additional recommendations

  • talking about how amazing vector caching is. I've often been able to get major improvements in speed when just doing something simple like changing an unordered_map to a vector and playing indexing games even with large data. All depends on your L1 cache size.
  • Not allocating variables in loops, preallocate any intermediate variables and just assign them in the loop for use. References encouraged when possible.
  • While strings are heavy... by god do I never want to go back to the days of using anything else
  • Release builds.. I cannot tell you the number of times I've had people complain about performance only to find out they were using debug builds on their production assets.

question about heaptrack roslaunched node

I am trying to use heaptrack to track memory. But how to heaptrack roslaunched executable?

I tried:
heaptrack roslaunch ${pkg_name} ${type_name}

then I found it is heaptracking a python executable "roslaunch" instead of my real executable.

std::deque won't release memory even after shrink_to_fit()

I am using std::deque to receive imu ROS message and odometry ROS message and pop_back() when a lidar message is processed.

It is all working well. But after days of continuous running. The memory consumption goes up to to 90% on my 16 GB memory PC. I used heaptrack to pin down the problem and found std::deque::push_back() allocate 14 GB memory at peak and leak 14 GB memory at the same time. I am not using pointer, the definition of imu_queue is as below:

std::deque<sensor_msgs::Imu> imu_queue_;

I tested my program running for 1 hour. It allocated 1.5GB and leak zero. But the memory consumption do goes up as time went by.

Initially the memory of std::deque is almost none. I checked its size, since I pop_front() all imu message while processing lidar. deque's size is around 37 at most time.

I use shrink_to_fit() after a constant period. But the situation is still the same.

Any clue where did I go wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.