9,406 reputation
12141
bio website
location
age
visits member for 3 years, 8 months
seen 2 hours ago

6h
comment Is testability and mockability really that important in web development?
Some applications benefit from automated testing, you grant that? Then please explain why the same benefits don't apply to web development.
1d
comment Memory management scheme for custom memory allocator
Thanks for clarifying, that makes some amount of sense. I'm not sure whether it's actually practial/good but it seems possible and could plausibly have the effect you want.
1d
comment Memory management scheme for custom memory allocator
What do you want to defragment? Everything that's mapped is referenced by raw pointers, so you can't move those. You could shuffle the regions assigned to not-yet-mapped handles (trivially by not settling on a region in Allocate, doing all actual work in Map) but since you must work around existing mappings this hardly deserves the term "defragmentation". Also, what are you trying to achieve with the allocate/map separation? It's a rather unorthodox API.
2d
comment Sizeof Structure in C
This belongs to StackOverflow, and there it would be a duplicate of Why isn't sizeof for a struct equal to the sum of sizeof of each member?.
Jul
10
comment Can Excel be a strong development platform?
For what sort of application could Excel possibly be a suitable platform? It's spreadsheet software. A macro to automate spreadsheet work, sure. Something deserving the term "application" on the other hand...
Jul
10
comment Why can't C arrays have 0 length?
@RobertHarvey All true, but your closing words (and the whole answer in retrospect) just seems like a confused and confusing way to explain that such an array (I think that's what this answer calls "an allocated chunk of memory"?) would have sizeof 0, and how that would cause trouble. All that can be explained using the proper concepts and terminology with no loss of brevity or clarity. Mixing up arrays and pointers only risks spreading the arrays = pointers misconception (which is more important in other contexts) for no benefit.
Jul
10
comment Why can't C arrays have 0 length?
Arrays aren't pointers.
Jul
10
comment What does it mean for a sorting algorithm to be “stable”?
@QuestionC But here's another algorithm that I've actually seen around: WikiSort. Don't know anyone using it in production though.
Jul
10
comment What does it mean for a sorting algorithm to be “stable”?
@QuestionC Actually I ran into it going through Wikipedia's table of sorting functions. I didn't see it anywhere else either, it seems to be somewhat obscure. I suspect that's because the "stable and in-place" requirement is rare to begin with and most people facing such a situation just swallow the additional comparisons of other, simpler alternatives. Mergesort can be made in-place at an extra log n factor, i.e. O(n * log n * log n) comparisons total. Block sort seems quite complex and who knows how well it works on real data.
Jul
10
comment What does it mean for a sorting algorithm to be “stable”?
@QuestionC It appears block sort is stable and fits those bounds.
Jul
9
comment What does it mean for a sorting algorithm to be “stable”?
Is it less efficient though? It seems "obvious", but some of the best sorting algorithms are stable by nature (e.g. anything based on merge sort, such as Tim sort), they don't need to do any explicit extra work to be stable.
Jul
9
comment Value of passing by reference
@gbjbaanb A reference type in C# is not like a reference in C++. Local variables, object fields and parameters of class type are more like pointers without pointer arithmetic, meaning the (C#) reference is passed "by value", i.e. copied, but the referenced object is not copied but aliased. In particular, you can write swap(T&, T&) in C++ but you can't write swap(T, T) in C#. For (restricted) C++ style pass-by-reference there's ref (so yes, swap(ref T, ref T) does work).
Jul
8
comment Why does Haskell's built in max function run faster than mine?
RE interpreting compiled code: That does make sense when one lifts the (kinda silly) restriction that "compilation" must refer to something that output machine code. A translation into bytecode is also a compiler (even most of the internals are exactly the same), yet the result must be interpreted. Unless you defictionalize the VM architecture set by casting it into silicon. Which some people consider "building specialized interpreter hardware".
Jul
5
comment Early attempt to remove Python GIL resulted in bad performance: Why?
The GvR quote describes performance "on the platform with the fastest locking primitive (Windows at the time)" so slow locks on Linux aren't relevant.
Jul
3
comment Early attempt to remove Python GIL resulted in bad performance: Why?
Note that refcount operation wouldn't be the only place needing synchronization. The quote mentions "fine-grained locks on all mutable data structures" which I presume includes at least a mutex for every list and dictionary object. Also, I don't think atomic integer operations are as efficient as the non-atomic equivalent regardless of contention, do you have a source for that?
Jul
2
comment File exists vs. File does not exist. Is there a difference in performance?
There are potential minuscule performance differences depending on how which side of the branch is treated as default... in machine code. But machine code layout is not just compiler business, it may vary within one compiler based on countless heuristics and hints (__builtin_assume). It's not something that most programmers even can be concerned with (no way to predict how the machine code will be organized), regardless of how tiny the difference is. I don't know how good this reason used to be but by now it's a long-dead unicorn so I wouldn't even mention that ever existed.
Jul
2
comment Data Oriented Design - impractical with more than 1-2 structure “members”?
Much better, downvote removed. Check out user2313838's answer for how SoA can be unified with nice "object"-oriented APIs (in the sense of abstractions, encapsulation, and "more local scope of basic functions"). It comes more naturally for AoS layout (since the array can be a dumb generic container rather than being married to the element type) but it's feasible.
Jul
1
comment Compiler warnings and errors
What's your experience? When you fixed the warnings caused by "option strict on", did you notice anything that might be an actual issue, or was it just bad style? The rule of thumb is that warnings exist for a reason, but applicable data beats rules of thumbs. If the fixes you applied so far were just reformulations to appease the compiler, maybe these warnings are not enough reason to fix them.
Jul
1
answered Data Oriented Design - impractical with more than 1-2 structure “members”?
Jul
1
comment Data Oriented Design - impractical with more than 1-2 structure “members”?
+1 AoS organization is perfectly amendable to a nice entity-oriented API, although admittedly it becomes uglier to use (ball->do_something(); versus ball_table.do_something(ball)) unless you want to fake a coherent entity via a pseudo-pointer (&ball_table, index).