« first day (353 days earlier)      last day (4599 days later) » 

9:00 PM
@CaptainGiraffe It's not about reflection. AFAIK methods do not have positions and rotations :) @CaptainLightning messed up the words :)
 
The basic idea would be to have a static vector (or other collection) of instances, and overload the ctor(s) to insert (and dtor to delete) the address of each object you create into/from this collection. Then in your timer code, just walk through that collection and do your thing.
 
I'm writing a game, @RMartinhoFernandes
 
Thanks for the chat ppl
 
Still never got DirectX 11 to work on an Intel Atom processor in hardware mode
Seems that compatibility mode 9_1 just doesn't work
Strange AccessViolation exception still
 
9:07 PM
I'm using both a physics library and a graphics library unawares of each other, and I will need to be able to create objects onscreen on the fly, update the positions of the sprites with the values returned by the physics library, and delete them as necessary
 
@CaptainGiraffe IMO, the next good keyboard music after Bach was done by Keith Emmerson (or possibly Rick Wakeman).
 
@JerryCoffin What language was that written in?
 
Bach is that dude from GEB, right?
;)
 
@RMartinhoFernandes Bach is a C# coder
 
(Mental note: actually listen to some Bach in the future. The book might make more sense afterwards.)
 
9:08 PM
Hrm? You can have a vector that holds instances of a class, @JerryCoffin?
 
Why doesn't Windows 8 support OpenGL contexts in "tailored" applications?
 
@IDWMaster Hard wired! (and I do mean "hard" -- the Modular Moog quite literally weighed about a ton, but Keith took it on tour anyway. It was still pretty light compared to the drum set that British Steel gave to Carl Palmer...
@CaptainLightning You can, but in this case you don't want to. You just have it hold their addresses.
 
I honestly haven't the slightest clue how to do that.
I can assume it would be something along the lines of vector<string> {member*, member1*}
 
To get the address of something, you use &something
Which returns a (typeofsomething*)
So you would want a vector<something*> {&member}
 
Ah. I keep mixing up pointers and references. Thanks
 
9:11 PM
@CaptainLightning No problem
I do coding in lots of different languages, so I get stuff like that mixed up all the time too
 
@CaptainLightning class X { static vector<X *> instances;};
 
I usually write backends in C++, and GUIs in C#
C++ in Windows 8 does seem an awful lot like C# now....
 
And then you do instances.push_back(this); in the ctor.
 
Static vector of instances is ugh, to be precise.
Keep a vector of those objects as part of the game state, not as global.
 
9:13 PM
@IDWMaster Looks like C++/CLI.
 
@RMartinhoFernandes right. remove/erase it in the dtor.
 
At least use a std::set :)
 
I see. Thanks for the tips @RMartinhoFernandes and @JerryCoffin
 
@RMartinhoFernandes Yeah. Guess it does. I never use C++/CLI though; I usually will write a library entirely in native code, then P/Invoke into it from a managed application (or write a native application and call a library that references a managed component)
 
@StackedCrooked Why? Does the order of the pointers matter? Do you expect to see multiple objects of the same type at the same address (without intervening destruction)?
 
9:14 PM
No, really, why are you telling people to write ugly code?
Shame on you!
 
@JerryCoffin When I need to keep a list of instances I usually use a set because it has simpler insert/erase syntax. And erase is faster.
 
@CatPlusPlus Given what he asked, it's pretty much the only thing that'll work.
 
Given what he asked, he didn't have a better idea. :P
 
std::this_thread::sleep_for(std::chrono::hours(8));
Good night.
 
You don't need a global vector of all possible class instances to manage game objects.
 
9:18 PM
@StackedCrooked push_back doesn't seem any more complex than using a set. Erasure speed may be better, but isn't necessarily. Depending on the number of items in the collection, it could easily be slower.
@RMartinhoFernandes Good night.
 
mawnin
 
hey guys
sorry had to leave
I'll be going to interviews soon...I have no chance both in hell and heaven
 
I still haven't touched those stupid math exercises.
I need infinity more hours.
 
By the way; would anyone like to contribute to my port of the CLR to native code?
 
If the exercises are stupid then you have no problem :)
 
9:23 PM
@LewsTherin There's many other guys out there that suck worse than you. They might make you look good in comparison :)
 
What exactly are you porting?
 
The CLR.
It seems.
 
@StackedCrooked maybe but when someone asks me a question I start to panic, sweat profusely, and mind goes blank lol
 
Thanks Sherlock.
 
I'm porting the base class library
 
9:25 PM
@LewsTherin Let me give you a hint. You are always right until the enemy proves otherwise.
take it from the supreme master of all things confidence over here
 
@LewsTherin A good interviewer would be able to look past that and see your skills.
 
I'm talking about the base class library, not the actual runtime itself
The first few libraries have a simple BinaryReader and BinaryWriter class
A simple Stream class
Which is abstract
Similar to the .NET framework
Except it's entirely native
So it should perform much faster than managed code
 
I don't know...hopefully. I know if they ask me to write quicksort I'm basically done for. Unless they give me the algorithm. I don't know what's going to happen...its only work experience anyways (that's what I tell myself xD)
 
Some problems I might need help with are:
International support
 
@IDWMaster The fundamental design of your library?
 
9:28 PM
Endianness
 
i.e.
 
Anyone using Windows 8: I ACTUALLY CLOSED A METRO APP WITHOUT USING TASK MANAGER!
 
the BCL has an inheritance-orgasm of a library
which would disgust me as a C++ library
 
@DeadMG No, currently just endianness and international support
 
at least C++ only makes that mistake in it's iostream libs
 
9:29 PM
Could use a more liberal alternative to std::string
 
Why are you porting System.Array?
 
why port the BCL at all?
 
And refcounting?
 
it's wider scope is the only thing good about it
 
@KianMayne Plz give me the codez
 
9:30 PM
Figured I'd port the whole thing
 
2 mins ago, by IDWMaster
So it should perform much faster than managed code
 
it's design is pretty terribad
 
@RMartinhoFernandes Weren't you sleeping?
 
His other brain half took over.
 
9:30 PM
@StackedCrooked I just Alt-F4ed and it worked
 
@KianMayne ALT+F4 only works in dev apps
 
I'm still confused about that CLR porting thing.
What's the purpose?
 
Apparently no CLR is involved.
 
Alt-F4? That's disappointing :(
 
@IDWMaster Worked in Weather
 
9:31 PM
Hmm. Interesting
 
CLR is the VM, isn't it?
 
@CatPlusPlus To have a faster implementation of the Base Class Library
Which is the main reason most people write C# code
 
Faster than what?
 
@CatPlusPlus Right.
 
@CatPlusPlus .NET
Microsoft themselves claim several times that .NET is slow
 
9:32 PM
And your implementation is how old, again?
 
As well as Mono
@CatPlusPlus Just started writing it
 
most people write C# code because they're under-informed about how usable modern C++ is, and because Microsoft wrote a ton of Windows-specific libs for it, like WPF/Windows Forms
 
Well, then you won't beat the JIT.
 
the BCL has an inherently inferior design to the STL
 
Wanna bet your Array is slower than System.Array?
 
9:33 PM
@RMartinhoFernandes Why would it be any slower?
 
Because you didn't spend years optimising it.
And the JIT implementation.
 
I'm not planning on using JIT
 
CLR is.
That's why it's not "slow", whatever that means.
 
he's not replacing the CLR
he's just porting the BCL to native code directly
as far as I understand it
 
9:34 PM
I know.
 
@CatPlusPlus Yes. I'm just porting the BCL
 
But the BCL runs on CLR, right?
 
@CatPlusPlus Yes, but it doesn't necessarily have to
 
not his BCL
 
Good lord, I'm talking about reference implementation.
 
9:35 PM
And System.Array is blazing fast.
 
Optimising doesn't mean "rewrite in native code", whatever native might mean.
 
@RMartinhoFernandes Any proof of that?
 
That's naive approach.
Any proof otherwise?
 
especially since the BCL's design sucks
 
Benchmark it.
 
9:36 PM
And please, don't write a loop that writes 100000 elements to it.
 
@CatPlusPlus Yes, I do have proof otherwise - research.microsoft.com/en-us/um/redmond/events/fs2010/…
 
I, for one, I'm tired of seeing this nonsensical crap.
 
But if you really want to know, things like new int[100] (C#) will be a lot faster than (T*)malloc(100*sizeof(T)); (C++)
No free list walking.
 
I misread "walking".
 
that's an unfair comparison
 
9:37 PM
@DeadMG That's the code he has there.
 
heh, my thing is still loading
 
Just making it "native" will not magically make it fast.
 
@RMartinhoFernandes Microsoft's presentation at BUILD made it sound like that
 
@CatPlusPlus +1
 
So the question is; how BIG is the performance improvement?
If there IS one?
 
9:39 PM
making it native will make it fast
but you would have to also port the algorithms involved
 
@IDWMaster Okay, what the hell does a presentation about data center performance have to do with anything?
 
that means creating a native GC running the same algorithms as the CLR GC
 
Wrong link. I was looking for their perf/watt thing they showed at build
 
Well, it might be faster when ported to native code.
 
The performance improvement is this big.
 
9:40 PM
But it doesn't necessarily have to be.
 
yes, it does have to be
 
Performance of memory management has a bit more variables involved than "is it a garbage collector?" bit.
 
@DeadMG Not magically.
 
there is no possible way that interpreting bytecode will be realistically faster than pre-compiling it in non-trivial programs
 
It's not interpreting bytecode.
It's compiling dynamically.
 
9:41 PM
right
 
To my understanding, the JIT works by compiling the bytecode to native code at runtime, then executing it
 
Online and in background, with running program context.
 
The slowdown here is often the JIT, and the GC
 
so you dynamically compile some of it- and while the JIT is running, your program can't be, for example
and then the rest gets interpreted
 
GC is not a slowdown, unless proven otherwise.
 
9:42 PM
that's still not going to be the same as just directly running native code
 
JIT can run without blocking program.
 
@CatPlusPlus Doesn't the GC interrupt the whole program while collection is in progress?
 
JIT hotpatches bytecode functions with native ones.
 
not with a concurrent application
 
@IDWMaster Bad GCs do.
 
9:42 PM
@IDWMaster Not incremental GCs, no.
 
if your application is using 100% CPU, then there's no way you can run the JIT without interrupting the application
 
See, you don't even know the subject fully, and yet you try to optimise it.
@DeadMG What's 100% CPU?
 
every user-mode cycle there is available to consume
 
If you can run 100% CPU without interruption, then your OS is dead, and JIT is the least of your concerns.
Even high priority threads consuming every bit they can get preempted.
 
yes, it's not a literal hundred per cent, it's simply the maximum achievable by a user-mode program
 
9:44 PM
So is it worth it to port the BCL to native code? Or is it simply unnecessary?
 
@IDWMaster It's not a good idea because the BCL sucks
 
Performance is one thing. What about maintainability and portability?
 
@IDWMaster Is it worth it? Would be nice to have C++ equivalents of some parts of it.
 
What about correctness?
 
pretty sure that we were only discussing performance
as it was the primary motivation for the suggested conversion
 
9:45 PM
@CatPlusPlus In terms of portability, the BCL is portable via mono
 
Yeah, but what about your port?
 
C++ is also portable, but can't have one bytecode for all CPU types
@CatPlusPlus At the moment, my port only runs on Windows-based OS's, but I'm working on expanding it to support Unix. It currently compiles under MSVCC and GCC
I guess the question is; when should native code be used, and when should managed code be used? Also; should all managed code be replaced with native code for performance? Is the trade-off worth it?
 
firstly, there are obvious subjective tradeoffs here
 
You can't answer those questions generally.
 
I don't use managed languages because I hate the goddamn languages, not because I hate managed platforms
 
9:50 PM
"It depends."
 
so there's a certain quality of "I'd prefer a managed C++ over a native C#"
 
No, wait, I think I'd answer the second one with a definite "No."
 
and secondly, the choice between managed and native is usually forced by the availability of libraries
 
Yeah.
 
consider game development
good luck finding real competitive libraries for game development in managed worlds
pretty much everything is native
 
9:51 PM
FFI is not really a problem.
 
the exceptions make headlines
 
@RMartinhoFernandes Maybe -- but then again, maybe not. GC advocates consistently compare the most sophisticated garbage collector they can find to some of the most naive manual managers possible. You also need to take more into account than the allocation itself to compare the two meaningfully at all. That said, writing new code in C++ using malloc is a lousy idea in any case.
 
but try to find a decent native UI library
 
@DeadMG The problem is that it's been tried, (at least twice -- Managed C++ and C++/CLI) but inevitably degenerates into something almost, but not quite completely, unlike C++.
 
@DeadMG What about combining a native game library and a managed UI library? Then you've got a managed game library, written mainly in native code
 
9:53 PM
"entirely".
 
@JerryCoffin That's because the CLR effectively cannot run C++. The result, therefore, was never going to be an actual managed C++.
@IDWMaster I'd never want that, because managed libraries have terrible design
you can't just port some interfaces between managed and native
managed libraries expect garbage collection, they expect reflection, they expect that over-use of inheritance is the normal
you'd have to re-write the interfaces from scratch to make a workable native UI library
 
@DeadMG There's more to it that "the CLR" though -- deterministic destruction and garbage collection just don't get along with each other well at all.
 
@JerryCoffin I honestly don't see why they can't play nice.
it is, however, a relatively simple fact that the CLR doesn't really support the pointers and stuff that the Standard basically mandates
for example, I believe that the Standard defines that a pointer can be reinterpret-cast to and from an integer of the appropriate size, and the resulting pointer shall be valid
how can you mix that with a compacting garbage collector?
 
@DeadMG Because GC makes destruction non-deterministic.
 
not necessarily
deterministic destruction is nothing more than a compiler generated try-finally
it doesn't even have to be implemented in the CLR at all
 
9:57 PM
@DeadMG The only way to mix is by keeping the two separate :(
 
the GC makes destruction - of GC-allocated objects - non-deterministic
 
@DeadMG In theory no -- but unless you know about something everybody else has missed, one of the first steps toward getting decent performance out of GC is making it non-deterministic.
 
there's no reason that objects allocated on the stack should not be deterministically destroyed
 
Anyways; back to the performance question. Once both native and managed code have been compiled; has anyone proven what the performance difference is between the two resulting binaries?
 
after all, what does the GC care about what I do on the stack, except as regards to GC references I hold?
 
9:59 PM
@IDWMaster Gosh, that question is meaningless.
Measure.
 

« first day (353 days earlier)      last day (4599 days later) »