mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Refactor extra binary blob tracks to not use STL data marshalling
Just like I refactored text splitting to no longer use std::vectors, std::strings, or temporary heap allocations, decreasing memory usage and improving performance; there's no reason to use a temporary heap-allocated std::vector to grab all extra binary blob indices, when instead the iteration can just be more immediate. Instead, what I've done is replaced binaryBlob::getExtra() with binaryBlob::nextExtra(), which takes in a pointer to an index variable, and will increment the index variable until it reaches an extra track. After the caller processes the extra track, it is the caller's responsibility to increment the variable again before passing it back to getExtra(). This avoids all heap allocations and brings down the memory usage of processing extra tracks.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef BINARYBLOB_H
|
||||
#define BINARYBLOB_H
|
||||
|
||||
#include <vector>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Laaaazyyyyyyy -flibit */
|
||||
// #define VVV_COMPILEMUSIC
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
int getSize(int _index);
|
||||
|
||||
std::vector<int> getExtra();
|
||||
bool nextExtra(size_t* start);
|
||||
|
||||
char* getAddress(int _index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user