Whats the least bad , memory or CPU overhead?
-
- Member
- Posts: 116
- Joined: Thu May 06, 2010 4:34 am
- Libera.chat IRC: peterbjornx
- Location: Leiden, The Netherlands
- Contact:
Whats the least bad , memory or CPU overhead?
I am writing some utility routines at this moment and i was wondering, should i add a cache for results or should i just have it fetch the result every time?
Re: Whats the least bad , memory or CPU overhead?
...then think about if it's worth the bother to optimize the code, then optimize it, then measure the performance again (because you might have made it worse, or introduced less-maintainable code for a neglectible performance gain).
Hence the mantra of optimization: measure, optimize, measure.
Hence the mantra of optimization: measure, optimize, measure.
Every good solution is obvious once you've found it.
-
- Member
- Posts: 598
- Joined: Mon Jul 05, 2010 4:15 pm
Re: Whats the least bad , memory or CPU overhead?
An interesting question is how do you profile your code in your OS?
There are a lot of good tools for code performance profiling that will not work on a OS for scratch.
There are a lot of good tools for code performance profiling that will not work on a OS for scratch.
-
- Member
- Posts: 204
- Joined: Thu Apr 12, 2007 8:15 am
- Location: Michigan
Re: Whats the least bad , memory or CPU overhead?
It depends, of course, on the realistic constraints of the particular project.
In theory, of course, space is more powerful than time.
In theory, of course, space is more powerful than time.
Some people are offended by the verifiable truth; such people tend to remain blissfully unencumbered by fact.
If you are one of these people, my posts may cause considerable discomfort. Read at your own risk.
If you are one of these people, my posts may cause considerable discomfort. Read at your own risk.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Whats the least bad , memory or CPU overhead?
Your project's hardware target has a lot of impact on which you trade off usually also. You can generally decide which path to take when you have to choose based on your own goals. "Must fit in 1.44MB" will obviously make you want to optimize more aggressively for space than for speed.
--All the best,
gravaera
--All the best,
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
- salil_bhagurkar
- Member
- Posts: 261
- Joined: Mon Feb 19, 2007 10:40 am
- Location: India
Re: Whats the least bad , memory or CPU overhead?
I use -finstrument-functions, and then output the function address and processor timestamp on each function entry and exit, on the serial port, which Qemu outputs to a file
Then I externally parse this file to match each address with the linker map and print out a table for each function and its average time spent, and number of entries into it.
This gives me a fair idea of performance problems.

Then I externally parse this file to match each address with the linker map and print out a table for each function and its average time spent, and number of entries into it.
This gives me a fair idea of performance problems.