-
February 13th, 2023, 17:19 #41
- Join Date
- Jun 2020
- Posts
- 537
-
February 13th, 2023, 17:44 #42My Forge creations: https://forge.fantasygrounds.com/crafter/9/view-profile
My GitHub: https://github.com/MeAndUnique
Buy me a coffee: https://ko-fi.com/meandunique
Discord: MeAndUnique#6805
-
February 13th, 2023, 17:52 #43
The cost in performance isn't in the act of being a table, it is in the act of creating a table. If the database node tables are created once and reused, then injecting a couple dozen function references once at instantiation (can even be done lazily) is genuinely negligible (massively less than 1%) in a system that uses ZIP archives as databases. Especially when considering that the FGU application itself already has to load some form of object for each node anyway to parse it from the underlying XML, which means the Lua userdata mechanism for mapping the underlying data could point directly to the C# objects resulting in script-side node interactions having virtually zero overhead of any sort.
My Forge creations: https://forge.fantasygrounds.com/crafter/9/view-profile
My GitHub: https://github.com/MeAndUnique
Buy me a coffee: https://ko-fi.com/meandunique
Discord: MeAndUnique#6805
-
February 13th, 2023, 17:57 #44My Forge creations: https://forge.fantasygrounds.com/crafter/9/view-profile
My GitHub: https://github.com/MeAndUnique
Buy me a coffee: https://ko-fi.com/meandunique
Discord: MeAndUnique#6805
-
February 13th, 2023, 17:59 #45
- Join Date
- Jun 2020
- Posts
- 537
I am not sure I understand what you're saying here.
Basically, any time a databasenode is returned (a userdata object) by a call to a control or some other userdata object, the underlying C# application would instantiate a new `UserData` class and return that. Each class does not have a whole XML library instantiated/loaded in it (as I understand the current problem is) because it points to a reference managed by a Singleton, of which the application would only instantiate one of.
-
February 13th, 2023, 18:00 #46
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
But all the functions have to be added to every databasenode object, or you can't call it like this [var.fn(...)]. Adding an additional "databasenode" context in the global space does not address that at all.
Regards,
JPG
-
February 13th, 2023, 18:03 #47
- Join Date
- Jun 2020
- Posts
- 537
I am sure I am missing a lot of context (since I don't have the sourcecode) but wouldn't the every databasenode object have all the functions, if instantiated using the example code I provided? This wouldn't be a lot of overhead, because the class itself only has a reference to an XML library, and doesn't create the memory for the library itself.
-
February 13th, 2023, 18:15 #48
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
As you say, I think there is context that you are missing. While I'm sure there will be more investigation into this part of the code when I get there, I think you are missing some key information in the way that Lua works in the interaction. A global object/script is very different than a custom data type with custom APIs.
For databasenodes to be called like they do know, you have to define every fn_name -> fn definition for every object in order to even allow that syntax to work, and then you have to make it contextual so that you know which object the function should be applied to (currently FG applies the fn_name -> object specific fn instance).
Regards,
JPG
-
February 13th, 2023, 18:45 #49
- Join Date
- Jun 2020
- Posts
- 537
-
February 13th, 2023, 21:25 #50
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,566
Unfortunately, the tech debt was acquired before my involvement with FG, and part of the original API design in FG v2. I would like to move all custom data types to a model like the databasenode -> DB migration I'm proposing and working on.
While I know that there are savings to be add in terms of computing effort/speed with the change, the big question is still what the magnitude of the changes are. I'm hoping for a large change that will make everyone excited; but as MeAndUnique mentioned, I need to test and figure out if the gains rise above the level of a margin of error in the processing times.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks