multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.41k stars 438 forks source link

Feature: introduce streams, byte arrays and simillar #3024

Closed CrosRoad95 closed 1 month ago

CrosRoad95 commented 1 year ago

Is your feature request related to a problem? Please describe.

Problem is with performance, for example scenario where you use tea encode to protect your assets: open and read file -> teaDecode -> replace this process is not fast, especially if someone have a lot of data to process what is not uncommon

Describe the solution you'd like

introduce streams, byte array and/or other structures that can be used to optimize server for example:

local file = fileOpen(...)
local stream = fileGetStream(file)
local teaDecodeStream = teaDecode(stream, ...) -- stream in, stream out
engineReplaceModel(teaDecodeStream)

that way we are skipping part where data are unnecessarily copied into and out from lua what will positively affect performance

Describe alternatives you've considered

/

Additional context

/

Security Policy

JeViCo commented 1 year ago

I like the idea of using streams but it should be suitable for #2947 as well. Big amount of data should not go throuth "C -> Lua -> C" loop. Possible solutions rn:

  1. Whole data management logic in "C" exluding the "Lua" part
  2. Stream stacks (allocate/push/pop) with Lua (Sounds too bad for me)
CrosRoad95 commented 2 months ago

Soon we will celebrate second anniversary of this issue 🎉 funny that feature that can significantly improve performance both server and client got no interest from mta team