6
« on: July 01, 2016, 12:48:20 PM »
The overall situation is a bit unfortunate. REXSpeeder uses a fixed 4-layer array, mainly is Pyridine's inexperience in programming, he wants speed, thinks std::array is fast, which is true to some extent. Lack of forward compatibility is the unfortunate consequence. Lack of profiling to determine whether std::array speed increase is actually meaningful (no way it can be). Also, he has one vector for each layer, so the user must pay the std::vector cost anyway. Future risk of increased layers past 9, I can't really approve of fixed-size arrays, one library version per layer maximum increase is a bad idea.
Pyridine's REXTile format has alignment because of his initial uint32_t, since Kyzrati specified the character glyph to be 4 bytes, maybe in case he wants future UTF-32. Alignment forces gap between REXTile characters, so REXSpeeder reads one character at a time, which could be a problem, I haven't benchmarked, although likely negligible since the file is compressed. On the other hand, if Pyridine uses 4 uint8_t, that would also have problems if Kyzrati ever moves to UTF-32, since forcing the uint32_t out of alignment is a disaster. I can't say my library is faster either, because I don't use zlib, and the lack of compression outside of emscripten's automatic compression causes a disk read bottleneck, which is probably a far bigger issue than Pyridine's problem of reading one REXTile at a time.
Overall, though, absolutely none of this matters. Emscripten automatically compresses, zlib-on-zlib is a mistake, so my library works when using emscripten. You have to read the entire library to use it anyway, and mine is the easiest. But on the other hand, every time you want to change the .rex file, you have to unpack it manually, a pain. I don't like REXSpeeder because the user must read all the interface sugar. But it works, and I approve of his alignment choice, even though my own library did things differently. Some of REXSpeeder's other choices look rather strange, like reading nonexistent characters past the end of a file, but I guess they aren't errors.