Yesterday my Profiling 101 workshop took place at this years Akademy in Brno. The room was packed and I got good feedback, so I hope you all learned something new :)
During my workshop, I showed you how to improve the performance of a word-count application which also creates a word histogram and finds the longest word of a file. I tried to put as many performance bottlenecks as possible into the original code base, which you can find here:
git clone git@git.kde.org:scratch/mwolff/akademy-2014.git
Instead of uploading my useless slides full of meme images, instead I’m now pushing my optimized code branch. I urge everyone to review the commits I did and read the individual commit messages ( Note : read this log from bottom to top). There are many useful tips and tricks in there. I furthermore plan to create a techbase article with the most important notes on how to use profilers for a given job. I’ll write another blog post once I’m done with that.
continue reading...
Hey all,
I’d like to have some feedback from you. Consider this code:
#include <iostream>
#include <memory.h>
using namespace std;
struct List {
List(int size) {
begin = new int[size];
memset(begin, 0, size);
end = begin + size;
}
~List() {
delete[] begin;
}
int at(int i) const {
return begin[i];
}
int size() const {
// std::cout << "size called" << std::endl;
return end - begin;
}
int& operator[](int i) {
return begin[i];
}
private:
int* begin;
int* end;
};
int main() {
const int s = 1000000;
for (int reps = 0; reps < 1000; ++reps) {
List l(s);
List l2(s);
// version 1
for ( int i = 0; i < l.size(); ++i ) {
// version 2
// for ( int i = 0, c = l.size(); i < c; ++i ) {
l2[i] = l.at(i);;
}
}
return 0;
}
continue reading...
Hey everyone!
I just committed an (imo) insanely useful feature for KCacheGrind: Transparent loading of compressed Callgrind files. Finally one does not have to keep those Callgrind files around uncompressed, hogging up lots of space. And what is even more important: It’s much easier to share these files now, as you can send or upload them as .gz
or better yet .bz2
and open them directly. KDE architecture just rocks :) So in KDE 4.5 the best profiling visualizer just got better :D
In related news: I’m spending my time as intern at KDAB currently by creating an application to visualize Massif. If you are interested, check the sources out on gitorious: http://gitorious.org/massif-visualizer
It’s still pretty limited in what it offers, yet is probably already more useful than the plain ASCII graph that ms_print
generates:
Visualization of a Massif output file
This is very WIP but the visuals are somewhat working now. I plan to make the whole graph react on user input, i.e. zoomable, click to show details about snapshots, show information about the heap items that make up the stacked part of the diagram, …
continue reading...