Skip to content

Instantly share code, notes, and snippets.

@pyaggi
pyaggi / glbindvertexarray_cost.md
Last active March 4, 2024 16:03
Cost of glBindVertexArray (VAO binding)

Cost of glBindVertexArray (VAO binding)

Is that expensive to call glBindVertexArray unnecessary ? Well, to answer that I created a loop that renders a cube with a VAO 200000 times and test it in different ways. In each test a single instance of a ModelClass (ModelCube) is used. ModelClass owns a VAO an two virtual functions draw() and bindAndDraw(). The cubes are render to random locations extracted from a precalculated array of Transforms.

  1. Set only the transform to get a base time

    renderTest()
    {
    
@pyaggi
pyaggi / entt_parallel.md
Last active May 16, 2019 17:38
Parallel processing with ENTT ECS

Parallel processing with ENTT

The idea es to evaluate if it is worth it to have parallel versions of some methods in order to speed up processing or obtain better readable code than trying to parallelize outside the library.

Tests

The first step in the analysis is to perform a basic benchmark test to see if some gain is achieved with rudimentary algorithms. For that matter a modified version of ENTT library is used, which posses parallel version of most of the methods. I modified ENTT library in a very straight forward and awful way, I just peek here and there an replaced the algorithms that GCC already implemented in parallel and renamed that method to same name with _par suffix. Then I replaced in other methods any calls I found to those 'double version methods' and I made those other also _par suffixed. Of course this is no way to parallelize code, thought must be put in order to decide where to parallelize, but it is a start. (btw: sorry to doing that to your code