View previous topic :: View next topic |
Author |
Message |
Grumalg
Joined: 04 Nov 2005 Posts: 70
|
Posted: Sun Dec 03, 2006 9:17 Post subject: Plugin writers, is this feasable? |
|
|
Noteing that nwnx4 has much better performance than nwnx2 got me wondering. Is the nwnx4 useage overhead low enough now that a plugin could implement arrays with comparable or better performance than pseudoarray techniques?
Say something that stored everything in string form in C arrays with an end user api something like:
CreateArray(string name, string index_x, string index_y)
GetArrayString(string name, string index_x, string index_y)
SetArrayString(string name, string index_x, string index_y)
The 'name' part is to allow for more than one array. Of course, variable numbers of dimensions would require different params or recognizing something like a value of -1 meaning the dimension wasn't used.
If this approach can deliver good performance other possibilities come to mind. Things like interacting with a SQL plugin to populate an array from a set of rows. I suspect something like that would be very handy for random encounter or random treasure lists application.
I also note that since array storage would be outside the nwn process that there might be good use made of this to conserve memory from it's 2gb limit.
<edit added> Of course linked lists and queue's would also be nice toys
--- Grumalg --- |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun Dec 03, 2006 11:19 Post subject: |
|
|
I've done that with the HashSet plugin for NWNX2. It's a bit more than arrays, but can be used like them.
Regarding performance: With the current hooking (*), NWNX4 can call 41.500 SQLEncodes() per second on my machine (AMD 64 3200+) as a real world example.
Code like this:
Code: | for (i=0; i<500; i++)
{
SetLocalString(oModule, "NWNX!INSTALLED", " ");
GetLocalString(oModule, "NWNX!INSTALLED");
}
|
peaks at a rate of 69.500 passes per second, i.e. the loop could iterate that often within one second, if the TMI restriction would not apply.
So yes, this would be feasible.
(*) I am currently under the impression that even better hooking will become available for NWN2 in the future. _________________ Papillon |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|