3,757 reputation
21932
bio website
location
age
visits member for 4 years, 5 months
seen 1 hour ago

Jul
9
answered Why is software OS specific?
Jun
20
comment Why was C# made with “new” and “virtual+override” keywords unlike Java?
You should learn C++!
Jun
11
comment Is my work on a developer test being taken advantage of?
Just make sure you don't get yourself into a situation where they could sue you for unauthorized access or modifications to their code.
May
24
comment Should I follow the normal path or fail early?
@mirabilos: Er, I never said it's good advice, nor that it's always correct. Like many other things, it's a reasonable first-order approximation, and I said I'm wondering if that's what the attempt was.
May
24
comment Should I follow the normal path or fail early?
@mirabilos: not sure what you're trying to say. I am aware how branch prediction works, and there is nothing that restricts it to assembly. When you have an if statement there is necessarily going to be a jump there, and not-taken implies executing the body of the 'if', so hopefully it's the common code.
May
22
comment Where did the notion of “one return only” come from?
@sbi: Or you could just learn to do it right from the beginning so that you can structure your code readably without sacrificing the optimization or hindering debugging. I don't think I've ever seen the single-return convention harm code in some way, but I've definitely seen multiple returns rear their ugly heads when I'm trying to set a breakpoint to find what values a function is returning and inevitably end up missing one of the 4 returns in the function.
May
22
comment Where did the notion of “one return only” come from?
You still want to do this with C++, because returning a single object lets the compiler avoid copies and moves entirely.
May
22
comment Should I follow the normal path or fail early?
Is it just me who thinks this has nothing to do with readability, but instead was probably just a misguided attempt at optimizing for static branch prediction?
May
3
comment If null is bad, why do modern languages implement it?
@MartinJames: The fewer invalid states your program has, the fewer ways it can be incorrect. Simple as that.
Apr
10
awarded  Notable Question
Mar
11
awarded  Notable Question
Feb
16
comment Does C# give you “less rope to hang yourself” than C++?
@supercat: Yeah, but the whole point here is that you can't rely on it behaving in any particular way for a generic implementation. This is in contrast to unspecified/implementation-defined behavior, where you can assume the behavior will be one of (potentially many) well-defined possibilities. That's a pretty subtle but also pretty critical difference.
Jan
3
awarded  Popular Question
Dec
28
awarded  Yearling
Dec
13
awarded  Popular Question
Jul
5
comment Demonstration of garbage collection being faster than manual memory management
I copied Raymond's code here, and to compare, I wrote my own version here. The ZIP file that contains the text file is here. On my computer, mine runs in 14 ms and Raymond's runs in 21 ms. Unless I did something wrong (which is possible), his 215-line code is 50% slower than my 48-line implementation, even without using memory-mapped files or custom memory pools (which he did use). Mine is half as long as the C# version. Did I do it wrong, or do you observe the same thing?
Jul
4
comment Demonstration of garbage collection being faster than manual memory management
Oops sorry my bad. @btilly should read my comment then.
Jul
4
comment Demonstration of garbage collection being faster than manual memory management
@GuySirton: Then again, they don't even seem to be benchmarking GCs in the first place -- they seem to just be comparing C++ to Java, with preallocated storage...
Jul
4
comment Demonstration of garbage collection being faster than manual memory management
@GuySirton: I can't reproduce the keithlea.com/javabench results. I just tried out the heapsort implementation, and even when comparing the output of my old C++ compiler (Visual C++ 13.10.4035) with the one from JRE 7, C++ beats Java quite noticeably. If you can reproduce any of them let me know which one and I'll try that one.
Jul
4
comment Demonstration of garbage collection being faster than manual memory management
@delnan: Oh, I see what you mean now, that's a great point, thanks for bringing it up!