cgvis the IT thing

From Signals back to Callbacks (Results)

Posted on February 18, 2010

See this Post for my motivation.

With the exchange of boost::signals2 to boost::function as delegates the project saved around 40% compilation time and 10% executable size. There are even Faster Delegates, may be we should give them a try.

Filed under: Programming No Comments

Header Compile Time

Posted on February 4, 2010

Just coming from the Signals/Callback messup I took a short look of compiling (parsing, no instantiation) times of some C++ and Boost Headers I usually have always on.

On my machine (GCC 4.4, x86-64) without any other flags (Optimization did not seem to have a influence). I always took the user-time; no waiting for data or such things.

Filed under: Uncategorized No Comments

From Signals back to Callbacks

Posted on February 4, 2010

Traffic Light! by Flickr user 92wardsenatorfe, CC-BY-ND
Most signals in our project are never planned to be a signal, e.g. whole communication between looslely coupled parts of a component. They could be exchanged through non-thread-safe callbacks (with boost::bind / boost::function) instead of boost::signals2' signals, as we know their instantiation time (during component init) and they usually just link to one object. Interestingly not only performances increases, also compile time seems to be heavy bound by boost::signals2. The compiler was g++ 4.4 (current Ubuntu)

Qt4 (Console) to Boost migration

Posted on January 6, 2010

(Note: this contains flame and half knowledge)

The last two months, I hat to migrate one small project from Qt4 to Boost to make it fit better into one bigger project. Fortunately it did not contain GUI stuff (this may be remain Qt).

This migration showed me three things:

1. Qt does improve a lot of things and you get accustomed to it.
2. Qt signals suck.
3. What to replace with what.

Don’t call your global variable ‘socket’

Posted on December 16, 2009

This small C++ issue ate my day yesterday. If you call your global variable 'socket' the compiler will use it for the socket-syscall (even when called by ::socket).

Ok, who would do that? In the same file you get the error:

main.cpp:5: error: ‘int socket’ redeclared as different kind of symbol
/usr/include/sys/socket.h:105: error: previous declaration of ‘int socket(int, int, int)’

But when done in a seperate file you will just get a SIGSEGV error at the call to socket (..) without a chance finding out whats the trouble. Especially when you don't use the socket function directly, e.g. it's hidden by boost::asio.

Filed under: Programming No Comments

GGP Reasoner online

Posted on April 26, 2009

The General Game Playing Reasoner (C++, LGPL3) is now online. It consists of a logic unit (unify and such things, you remember from your AI course ;) ) and a Game Description Language (GDL) abstraction layer.

You'll find it on the General Game Playing Website of TUD.

Filed under: Programming No Comments

Fast std::string on the stack & fast string concatenator

Posted on April 10, 2009

So, as I promised, here are some techniques I used to speed up the logic system in the General Game Player module. The logic subsystem is using the standard unify-approach from the book Artificial Intelligence - A modern approach. By doing this there are a lot of string operations which were slow when using std::string for the strings and std::ostringstream for concatenation. On the other side, I did not wanted to loose the object oriented approach, so I did not used C-Strings.

But StackStrings ;) These are small objects covering a C-String (char [] field) and providing operations like substr(), length() and conversion operators. The recursive unify algorithm garantuees that the length of the strings (at least most) will not get bigger, so it is possible to allocate the string on the stack and let all subfunctions use them. The string is not 0-terminated, it has it's length as a second member variable. This makes it possible to generate a substring just by providing a pointer and the length of the original string, without copying and inserting a 0.

How to use?

// Allocating by Hand
char field [length];
SString s (field, length);
// Doing this with a Macro
STACKSTRING (field, s, length);
s.setTo ("what ever you want it to have");
// now all functions can use s as long as the memory on the stack exists (no allocation & deallocation)

The profiler showed me no significant string operation consts anymore; before it was >50% just by allocation & deallocation.

The other slow part I found was std::ostringstream for string concatenation. When you gurarantee, that all strings live until the final concatenation, then you can use it. Original std::ostringstream copies all and does some thread locking which was not necessary for me.

FastStringCollector collector;
std::string a; SString b; // for SString see above
collector << a << b;
std::string c = collector.str(); // collection will be done all here.

So both classes are not as powerful as the C++ STL variants but much faster in the special cases for me.

The stackstring can be fond here: stackstring.h
The fast collector here: faststringcollector

Filed under: Programming No Comments

General Game Playing

Posted on April 5, 2009

Our team "informafiosi" got the 3rd price on the General Game Playing competition of TU-Dresden. We are very proud of our own C++ reasoner and logic engine, so I want to fix just some last bugs and will put it online after the examination. The player code itself (MonteCarlo and MinMax) is not so interesting for public (and I don't know wether the GGP staff likes having a full featured player online), so I keep that offline.

017

Slides can be found here.

Beleg Thesis online

Posted on September 30, 2008

Beleg thesis is online and can be found alltogether with the tetrahedral mesh renderer TetraViewer2 here. You can grab the source and build it foryourself; but I cannot release it yet to GPL as the university didn't yet cleared which license they use for their own library. But you shall be free to use it for academical purposes.

Note that GPU GLSL renderer needs a GeForce8 to render properly as it uses integer textures and direct texture access (with integer coordinates) in order to fast access the mesh from a fragment shader.

Some points from the web presentation:

  • 3 Preintegration systems: naive, Bin-Approach from [LWM04], Taylor-Preintegration (currently not working)
  • 3 Rendering approaches: FineDrawer (GPU Raycasting), SingleDrawer (Cell Projection), SoftwareDrawer (Software Raycasting)
  • 2 Tetrahedron sorting approaches needed by SingleDrawer
  • 2 Classification systems
  • TetGen-Importer
  • FLTK2 GUI
  • Self test for preintegration
  • Multithreading support, gaining better performance for preintegration on multi core CPUs
  • Support for Windows, Linux, Mac OSX
Filed under: Uncategorized No Comments

Belegarbeit

Posted on September 16, 2008

Die Belegarbeit zum Thema "Visualisierung in Tetraedernetzen" ist nun fertig und abgegeben, am Donnerstag 18. September um 9 wird sie verteidigt, falls sich das jemand anschauen möchte. Danach stell ich sie auch gern online, sofern ich eine Erlaubnis bekomme.

Finished a so called "beleg" thesis (Visiualization in tetrahedral meshes) and will give a short defense at thursday 18th september 9am. The work will be put online when I get the admission; but it's in german.

Update:

The presentation is moved to Thursday 25th September 10h30. Work will be published afterwards.

Filed under: Projects No Comments