4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions
comment 4y ago · link · parent
> FreeBSD's malloc (jemalloc) is very forgiving of buggy/hostile code compared to something like otto malloc.
Sounds vague. I'm not disputing it, as I haven't read the code of the two mallocs. But I would be curious about the details. Does anybody know what that's about? I was under the impression that jemalloc was seen as quite robust, not least thanks to doing away with free-lists (which is also true for otto malloc, as far as I can tell from cursory research).
comment 4y ago · link · parent
Also, some poorly rate-limited crawlers actually abide by robots.txt, so it's useful to prevent unnecessary load.
comment 4y ago · link · parent
Sorry for the false flag.
comment 4y ago · link · parent
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://static.cloudflareinsights.com/beacon.min.js/v652eace1692a40cfa3763df669d7439c1639079717194. (Reason: CORS request did not succeed).
None of the “sha512” hashes in the integrity attribute match the content of the subresource.
Edit: works in Chromium, but not in Firefox.comment 4y ago · link · parent
I've recently read James Clavell's Shōgun and the way this book depicted how physical contact and intimacy was treated in Japan circa 1600 really resonates with how I feel about those things, i.e. whatever happens between two people behind close doors is no big deal, public nudity (devoid of sex) is no big deal, but casual touching, hugging, kissing with everyone at every turn which is so commonplace in Western cultures is a no-no.
I highly recommend the book btw. It gave me a picture of a beautiful place and culture.
comment 4y ago · link · parent
comment 4y ago · link · parent
Oxide and Friends - stories from low-level programming world (firmware, operating systems, etc.): <https://toppodcast.com/podcast_feeds/oxide-and-friends/>
On The Metal (discontinued) - same as above, from the same people: <https://oxide.computer/podcasts>
(edited: I thought Oxide and Friends was discontinued, but I was wrong. Removed the misinformation.)
886.
Browsers don't like their windows too big
2 points · by GrumpySloth · 4y ago · discuss
comment 4y ago · link · parent
It's also an apples-to-oranges comparison, since std::sort and qsort implement different algorithms.
A lot of std::sort's performance is actually from using the version without any callbacks. If you pass a comparator function which just compares two integers the obvious way, it gets much slower. So one of std::sort's biggest advantages is actually not that it uses templates, but that it's specialized for the common case of not needing a custom callback. Theoretically the compiler should make the two cases the same, but apparently GCC is too dumb (that's not a slight on GCC; I think people expect too much from compilers):
------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------
std_sort_random 52881299 ns 52873089 ns 14
std_sort_with_callback_random 63319633 ns 63307876 ns 11
qsort_random 106803314 ns 106784567 ns 7
external_sort_random 97642851 ns 97640888 ns 7
std_sort_sorted 8433311 ns 8432564 ns 82
std_sort_with_callback_sorted 13868016 ns 13865170 ns 50
qsort_sorted 28098439 ns 28093720 ns 26
external_sort_sorted 33629020 ns 33628108 ns 21
external_sort is just std::sort hidden behind an extern function implemented in a separate .o file. Those benchmarks are from sorting 1MB of random and already-sorted data (as indicated in the names). I think it's important to test such cases, because often online people benchmark code which is written all in a single file, whereas real-life C++ projects are usually organized in such a way that every little class is in its own little file, which gets compiled into a separated object file, and then it all gets linked together without LTO. And then those same people go on to claim performance benefits of their language without actually using the setup which enables those benefits, which IMO is a bit dishonest.When I drill further down into everything I want to drill into, maybe I'll publish the source for the benchmarks somewhere.
comment 4y ago · link · parent
From what I've been told, C++ games do another thing and just use arena allocators, which make allocations cheap (just an integer addition, provided you know a reasonable upper bound on the size of an arena, and if you don't, you may reserve a large piece of virtual memory, and commit it later in reasonably small, but also not too large chunks) and free-s even cheaper (either reset the integer, so that the arena can be reused, or a single syscall to unmap the whole arena in one go). That's a different strategy than making a lot of little allocs and frees, and then trying to minimize them by reusing objects, which is also quite hairy.
comment 4y ago · link · parent
comment 4y ago · link · parent
fun replace_head_with_1 (_::xs) = 1::xs;
val a = [2, 3, 4];
val b = replace_head_with_1 a;
Now a and b share the tail.And a linked list is only a simple demonstration of a chain of pointers. It occurs spontaneously outside of containers, when you just write e.g. classes which have objects of other classes as their fields. In Haskell that would be records, or just an algebraic data type. Or just closures.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent