|
pinning does not solve this problem. I don't need a random pointer .NET produced from the GC heap.
The only thing i could do with that is throw it away. It's useless for this
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
If you want to do this in the dotNet framework and have it cross platform you're going to want to use one of the newer frameworks anyway as the older ones are not generally cross platform. I don't see the problem here.
|
|
|
|
|
a newer framework doesn't change the landscape though. I'm using the latest stuff anyway.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
What's the problem? Just do exactly that:
int[] foo = new int[1000000]; And it'll be allocated for you from the LOH.
Heck, you can do this if you want to:
int[] foo = new int[500000000];
Provided the max index fits in 31 bits (and the whole item is less than 2GB) .NET will let you have it if it can.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
i know that, but it's not efficient and doesn't solve the basic issue, which is persistent, rapidly searchable storage.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
If you want something to be truly rapid, you'd perhaps need to look at a native programming language like C++. Yes, .NET is supposed to make things easier, but not necessarily faster executing.
|
|
|
|
|
I'm not looking for something that's bit level optimized.
I'm fine with looking at complexity as for example O(log N), and that's fine, without worrying about the .NET overhead on top of the base functionality.
Nah, mem mapped files, if i could use them like they were intended but under .NET, would make my programming task easier. Not necessarily make the program faster.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: I'm fine with looking at complexity as for example O(log N), and that's fine, without worrying about the .NET overhead on top of the base functionality.
Doing a full u-turn, are we? This was your response to another person on this thread:
honey the codewitch wrote:
but it's not efficient and doesn't solve the basic issue, which is persistent, rapidly searchable storage.
|
|
|
|
|
No I'm not, because in this case, there's an order of magnitude of difference in performance between using the windows memory paging system, and seeking around a disk file all the time.
It changes the complexity.
I'm not concerned about 10% improvements.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
Oh boy, you've been paying attention
GC is great for string management compared to a traditional heap.
for mapping a b-tree or b+tree to disk using memory mapped files not so much.
It would be cool if .NET had a mechanism whereby you could create uncollected heaps that you manually destroy, and could allocate objects to them somehow. Maybe by making an appdomain with an UN GC'd heap in it or something.
I know you can suspend garbage collection but that's not really what i'd be after because that impacts all objects.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
The MMF class is just a wrapper around the Interop code.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
As is quite a lot of the BCL.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
yeah i forgot about it, but it doesn't change the same underlying issue, and isn't useful to me. It's the same thing as the wrapper i wrote a decade or more or so ago.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
modified 18-Sep-19 15:33pm.
|
|
|
|
|
Ok,
This is the Lounge. THIS post here is purely programmer speak so ... take it to a forum. Pick one.
|
|
|
|
|
my posts of this nature were already weighed in on by Chris.
they've been ruled okay for the lounge, so if you don't like them skip them or block me.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: my posts of this nature were already weighed in on by Chris
Careful.
I said posts that talk about general programming stuff like "here's what I'm doing" are fine. Posts that are of a technical nature that are better suited to one of the dedicated programming forums should be posted in the appropriate forum in order to allow members to discuss programming topics.
Yeah it's a grey area, but follow the spirit.
cheers
Chris Maunder
|
|
|
|
|
I hear, you and I'm trying. My brain is all tech whenever i'm on a coding jag, so i eat sleep and breathe it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
You ever get to the point where you try and have conversations with non-coders and you get internal parsing errors?
I guess the question could be "do you ever not get to the point..."
cheers
Chris Maunder
|
|
|
|
|
yes i do. my solution thus far has been while i'm coding to limit my exposure to non-coders.
But i wind up here a lot lately while in the middle of it. Mainly because i look here for inspiration and a break from the actual writing of code. sometimes to vent about chicanery in MS products and the like too. Still, I can't turn my mind away from it entirely when i'm in the thick of it. I'm like a dog with a bone.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Environments designated to making simple things simple tend to make complicated things more complicated. Or maybe not, in the case of .NET, there's the unsafe keyword which allows you to work on raw pointers. However, that indeed doesn't help much with disk stuff.
See it this way, C# is the polar opposite of C here. In C, complex things and simple things work about the same way at the cost of simple things being ridiculously complicated.
I remember a project of mine where I combined the strengths of two worlds, I did my low-level in C (technically C++, but I had raw pointers at work), exposed a C interface and did my business logic in C#. Such a mixed design is of course too easy to get wrong, but I think I've managed to make it make sense.
|
|
|
|
|
I completely agree, and I've done similar. It's just that here, it's not really my goal to make something tied to the windows platform specifically, and pretty much no matter the route i take as soon as I'm relying on that mixed managed and unmanaged code I'm also inherently tying it to a platform.
Sure I can cross compile the unmanaged code, but even then, it's one package per platform - not what i want.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Don't quote me, but I am rather sure that you can't do that in a platform-agnostic manner. Going with P/Invoke or a low-level library in C will require platform ties as the C API doesn't know of the concept you need (hey, the C standard doesn't even have a concept of alignment). From what I know, the C++ standard library doesn't have this concept either and the moment your standard libraries don't provide something, you have to work with IFDEFs for platforms. Be it with .NET, C++ or any other language.
|
|
|
|
|
yeah but i think you can do p/invoke in mono to access ELF binaries (or whatever they'll called these days), etc. worst case I'd use #if in C# to plug in the right p/invoke attributes for the platform
So like i said, it might be that I could cross compile the unmanaged bits, but in any case it doesn't give me what i want here.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|