Performance tips

  • This topic is empty.
  • Author
    Posts
  • #215
    Chris Torr
    Keymaster
    August 7, 2020

    Please post any tips you have on optimisation of MULTOS applications here.

    To start the ball rolling, here are a couple.

    Use of RAM
    If you have application variables that you modify intensively, the best place to put them is in RAM. In MULTOS that means either using automatic variables (i.e. created on the stack) or placing variables in session memory (using the melsession pragma). If the amount of such data is too big to fit in RAM or needs to be static, it may still be worth having a RAM scratch-pad that you can copy subsets of data into to work on.

    EEPROM Page Alignment
    Try and make sure that the static variables in your application that you need to update DO NOT cross a page boundary, as this increases the number of EEPROM write operations required at a low level. The beginning of static memory is page aligned but the page size varies depending on the underlying chip. This ranges from 256 bytes down to 32 bytes, but all are a multiple of 32 bytes.

    #362
    Chris Torr
    Keymaster
    August 7, 2020

    If you need to clear a block of memory, use multosClear() rather than memset(). This works for up to 255 byte buffer and is a single MEL instruction so is much quicker.

  • You must be logged in to reply to this topic.