13,820 reputation
13358
bio website
location
age
visits member for 4 years, 4 months
seen 6 mins ago

Jan
2
comment Are noncontiguous arrays performant?
You've exhausted the theory (taken cache into account, discussed asymptotic complexity), all that's left is to plug in the parameters (here, 4M items per sublist) and maybe micro-optimize. Now is the time to benchmark, because without fixing the hardware and implementation, there is too little data to discuss performance further.
Jan
1
awarded  Nice Answer
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
@amon I know, and maybe I should have made that clearer, but it seems OP is only interested in Java- and C#-like languages where heap allocation is almost mandatory (and implicit) because of reference semantics and lossless casts between subtypes. Good point about Rust using what amounts to escape analysis though!
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
@TheodorosChatzigiannakis I include changing allocation strategy in escape analysis (because honestly that seems to be the only thing it's ever used for).
Jan
1
revised What are the caveats of implementing fundamental types (like int) as classes?
added 139 characters in body
Jan
1
revised What are the caveats of implementing fundamental types (like int) as classes?
added 319 characters in body
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
@TheodorosChatzigiannakis Inlining across library boundaries is certainly possible, though it's yet another item on the "high-end optimizations I'd like to have" shopping list. I feel obliged to point out though that it's notoriously tricky to get completely right without being so conservative as to be useless.
Jan
1
answered What are the caveats of implementing fundamental types (like int) as classes?
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
Check out the implementation of any of the dynamically typed languages that treat integers and such as objects. The final primitive CPU instruction can very well be hidden in a method (operator overload) in the only-somewhat-privileged class implementation in the runtime library. The details would look different with a static type system and compiler but it's no fundamental problem. At worst it just makes things even slower.
Dec
30
comment Using macros to implement a generic vector (dynamic array) in C. Is this a good idea?
Are those five macros really that large? Regardless, a SO question about the performance seems sensible, then this site can focus on semi-technical reasons besides performance.
Dec
30
comment Using macros to implement a generic vector (dynamic array) in C. Is this a good idea?
Smaller executable doesn't surprise me (though I would expect it to worsen as the programs grows larger) but higher speed seems fishy assuming GCC's inlining heuristics are tuned well. Can you show the definitions of the macros and how you benchmark it?
Dec
29
awarded  Nice Answer
Dec
29
answered Why is C still in the category of High Level Language?
Dec
25
comment Is checking return values always required?
@DeadMG For signed integers. There are no integers in this question.
Dec
24
comment Is checking return values always required?
@gnat But since we're dealing with floats, not with integers, the overflow will "only" result in infinity, not in wrap-around to negative quantities.
Dec
24
comment Reject pull request or accept incorrect code?
There's a difference between "simply factually incorrect", "this may be correct, but is so low-quality I cannot accept it into the codebase", and "I subjectively just don't like these parts". Which case(s) are you asking about?
Dec
23
comment How did OOP evolve to include the notion of Properties
The bare language feature is just convenient syntactic sugar for getter and setter methods. Whether there are deeper reasons behind the interpretation and terminology, I do not know.
Dec
19
answered How early does a hashable type need to become immutable?
Dec
19
comment How early does a hashable type need to become immutable?
The code is runnable, if you concatenate the two snippets and replace the bare value in Baz.__init__ with any concrete value.
Dec
17
comment Why are Scala's Either and Option types not interfaces/traits but classes?
What's wrong with Either[CompileFailure, CompileSuccess]?