Skip to content

Arrays

Benjamin Otte requested to merge wip/otte/vector into master

This is the branch with the results of me playing with the idea of imitating std::vector and templates with xmacros.

The result is a surprisingly pleasant replacement for GArray and GPtrArray, mainly because it provides type safety.

The disadvantage is that grepping the code no longer works because all function calls are expanded xmacros.

I tried to do some benchmarking, but the results were too unreliable because they were microbenchmarks and microbenchmarks are too easy to disturb: I got 2x faster/slower results in reruns.

Of course, there are some cases where this code is significantly faster in microbenchmarks, which is quickly constructing on-stack arrays in preallocated memory. Because of coure, no mallocs are needed in that case. An example for that would be constructing the icon names to look up in the icon theme or constructing results in CSS lookups.
The microbenchmark for that is about 2x-5x faster.

Edited by Benjamin Otte

Merge request reports