Friday, May 20, 2022

gtl::factory reaches a testing phase!

     After three weeks of working at gtl::factory, I'm proud to see it finally reach a stable enough state to be tested against other containers such as gtl::ld_vector. I began writing the tests earlier this week, and it compares the speed of four containers: vector, list, factory, and ld_vector.


     The tests time each container on their performance when using push_back, removal functions such as remove or erase, iteration through the container, random removal from the container, and storing large objects. When writing the test for the large object, I discovered some extra minor bugs that hadn't been spotted in the first two weeks of research, but resolved them in a short amount of time. The biggest issue that factory had was resetting the highest_key during remove. Remove should not change the key unless the programmer calls for a remove from the end of the array, or uses pop_back. The key being adjusted caused issues with loop-based removing items from the container. Another issue I came across was the router table missing keys, since it was using capacity instead of highest_key. the router array may not be the same size as the data array but that's the intention so every key is retained when using the factory.

    the test on a large image (2048x2048) is shown in this screenshot. the test adds 40 instances of the image to the containers, iterates, removes 10 random spots of the array, then iterates through the smaller container after removals finish. The speed is recorded using a simple implementation of std::chrono, which I did revisit when writing the test!

    All-in-all, another good week working on the factory, and I'm pleased to see more progress! Soon I plan to implement factory inside of GBlitter for an optimization feature.

No comments:

Post a Comment