varsill

varsill

Membrane Core Team

Hello,

I have a question concerning the comparison of memory consumption of programs run on BEAM.

Suppose that I have two versions of a program performing some computation, and I want to know which is consuming less memory. I want to have an automated testing system that runs two versions of the program multiple times in some isolated environment, measures their memory consumption during the run, and tells me which statistically uses less memory.

How should I perform the memory measurements? In particular:

  1. What method should I use to fetch the current memory usage? Would :erlang.memory(:total) be enough, or should I subtract some constant “initial” value (e.g., the amount of memory used by the BEAM before running the program)? Or perhaps it would be better, to sum up the memory used by the particular processes building my program?
  2. How often should I perform the measurement?
  3. How should I deal with the randomness of GC invocations? The results of the tests seem to be susceptible to the moment when the GC is run.
  4. How could a final metric (based on the memory measurements) look to give me a view on which version is, in fact, “better”?

I know that my question is really general, and answering it precisely requires some more specific definition of what it means that a particular program uses less memory than the other (do we take under consideration the maximum peak memory usage, or an average usage of memory, which type of memory are we interested in measuring, etc.), but I would appreciate some general tips on how such tests should be performed.

Best wishes,
Łukasz

Showing Posts 1 to 1

LostKobrakai

LostKobrakai

Not necessarily an answer to your questions, but Benchee can perform memory usage based benchmarks.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews