Skip to content

Commit

Permalink
GRF: Speed up file table decoding via table.new
Browse files Browse the repository at this point in the history
Another free 70ms improvement on my machine. Obviously, the entire thing is still very slow and wasteful, but that can wait.
  • Loading branch information
rdw-software committed Aug 29, 2023
1 parent a6a1b8b commit a9401ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Core/FileFormats/RagnarokGRF.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local bit = require("bit")
local ffi = require("ffi")
local uv = require("uv")
local zlib = require("zlib")
require("table.new")

local tonumber = tonumber

Expand Down Expand Up @@ -142,7 +143,8 @@ function RagnarokGRF:DecodeFileEntries()

local movingConversionPointer = ffi_cast("char*", decompressedTableBytes)

local entries = {}
local entries = table.new(self.fileCount, 0)

for index = 0, self.fileCount - 1 do
local normalizedCaseInsensitiveFilePath, numProcessedBytesToSkip = self:DecodeFileName(movingConversionPointer)
movingConversionPointer = movingConversionPointer + numProcessedBytesToSkip + 1 -- \0 terminator
Expand Down

0 comments on commit a9401ba

Please sign in to comment.