Fortsätt till huvudinnehåll

Coding Dojo for smart memory usage

The target hardware that I develop for at work have several types of memory. Some are fast, but extremely limited, others are large but not that fast. As a developer for that architecture it is very important to make wise choices when it comes to how to use the different types of memory (no tools are available for helping out, it is all up to the developer).

Several new developers with limited or no experience of developing under these cirumstances have recently joined us. In order to help them understand the impact different memory usage can have I have started to prepare material for a Coding Dojo which will start off with a non-optimal memory model and by applying some simple patterns they should be able to optimize the performance by several hundered percent.

Looking forward to sharing my knowledge. We all should, as much as possible.

Kommentarer

  1. Kul! Vore kul att ta del av det, men det kanske blir arbetsgivarens material... Kanske kan få en privat dojo hemma hos dig (kanske med en god tårta till ;) )

    SvaraRadera
    Svar
    1. Nu är jag säker på att mina kommentarer försvinner när jag skriver in dem via mobilen. Andra gången jag svarar dig nu.
      Just den här Dojon blir väldigt specifik för denna arkitektur, men vi har en annan som funkar på vilken dator som helst med en hyfsat modern C++ kompilator. Nu får vi säkert inte sprida materialet ändå men det går ju att inspireras av den.

      Radera
    2. Får ha en hemlig privat dojo då :)

      Radera

Skicka en kommentar

Populära inlägg i den här bloggen

C# Enum as bit field

Bit field enum Whenever you wish to express combinations of properties of an object, bit fields are a good way to accomplish this. As a simple example, consider a file in the file system. It can be Readable , Writable , Hidden or a combination these. The different attributes can be defined as an enum : [Flags] public enum FileAttribute {   None      = 0b0000;   Readable  = 0b0001;   Writeable = 0b0010;   Hidden    = 0b0100; } To indicate that this enum is expected to be used as a bit field I have defined it with the FlagsAttribute . It is important to understand that the FlagsAttribute does nothing more than making some changes to how the ToString method of the enum works, making it possible to print out all flags. It does not introduce any validation or special treatment of the enum in any other way. I have defined the values of the different fields of the enum using binary representation, this should make it even more clear that this is a bit field and which bi

Codility tasks - Part I

I was recently faced with two codility tasks when applying for a job as an Embedded Software Engineer. For those of you who arn't familiar with Codility you can check out their website here:  www.codility.com Task one - Dominator The first task was called Dominator. The goal was to, given a std::vector of integers, find an integer that occurs in more than half of the positions in the vector. If no dominator was found -1 should be returned. My approach was to loop through the vector from the first to the last element, using a std::map to count the number of occurences of each integer. If the count ever reached above half the size of the vector I stopped and returned that integer and if I reached the end without finding a dominator I returned -1. So was that a good approach? Well, the reviewer at the company rated the solution as 'pretty ok'. His preferred solution was store the first integer in the array and set a counter to 1. Then loop through the remaining i