|
-
January 6th, 2013, 07:58 AM
#8
Re: Representing and dynamically creating a managed object in assembly
Have a look at this development of memory consumption (red any yellow curves) shown by my own performance monitoring tool, monitoring another instance of itself:
I wouldve thought it wouldve have made a bigger ding in performance than that. Though when you think about it, when Im running my tests, there are thousands of objects per second being created/destroyed and every one of those objects will range from a few hundred to a few hundred thousand bytes. I believe I am about to the point on the managed side and the assembly side as fast as I can get it till I learn something new.
As far as using structures go, I have something working, though Im not sure if I like it yet. I ended up getting rid of the idea of the actual data inside the structure, what I did was create an array for each type, the elements in the array hold pointers to the actual data. I decided to do an entry for each element I had listed in the structure so that I wouldnt be confined to having all the data in contiguous memory, this way if I want the array in a different location from the sign or decimalplace it wont break anything. I had to create a routine in the assembly language side to translate what c++ was passing to it, not as elegant as Id like it to be, but it is kicking out correct results, I havent even started profiling it yet, but it appears to be about as fast as the other way and I havent even started looking for ways to optimize it yet.
The high-level language equivalent is the assignment of a primitive type. What you'd need to do instead is the equivalent of a C++ memcpy(). In x86 assemply this would be done using a REP MOVSx instruction, where the x represents the data chunk size. Desite its harmless look, this instruction actually is a loop. I'm sure there's an equivalent instruction in x64 (perhaps even with a very similar name).
ya the REP modifier is still in use, Im not sure about the movsx, I think I had used that instruction when I was keeping up the 32 bit version. As far as data chunk my arrays are of unsigned __int64 so I am using the full 64 bits, in truth, I think thats my biggest advantage over MS BigInteger (which I beleive is using 2s complement in a byte array) Im taking care of in one instruction what takes them 8 to do.
Last edited by AKRichard; January 6th, 2013 at 08:07 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|