Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions

Submissions

comment 4y ago · link · parent

Many of the claims on this page are supported with links to commits, mailing lists posts, etc. However then there is this claim, which lacks any link supporting it:

> 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

I wonder if anyone here has experience with both Delphi and SwiftUI. I'd be curious to know which one is more comfortable.

comment 4y ago · link · parent

Happy birthday! My favourite distro for ~10 years now.

comment 4y ago · link · parent

While robots.txt is not a good security measure, it's a good tool for preventing pollution of search results with pages like wp_login.php. More to steer users to the subset of pages that are useful to them, away from the pages which are only an implementation detail.

Also, some poorly rate-limited crawlers actually abide by robots.txt, so it's useful to prevent unnecessary load.

comment 4y ago · link · parent

The web is a public space. There are no doors.

Robots.txt is a way of saying "these are not the pages you are looking for".

comment 4y ago · link · parent

I've tracked down the root cause: I needed to disable two uBlock Filters in order to successfully load the page: Fanboy's Annoyance and Fanboy's Social. It seems that they block some JS related to social buttons (https://japan-dev.com/assets/socialButton.9ddbb1cc.js) and that makes the rest of JS responsible for the rest of the page to not execute (due to a failed request).

Sorry for the false flag.

comment 4y ago · link · parent

I'm getting a blank page. Looking at the source, there is no static content on it, only JS. I have JS turned on, but it seems CORS is blocking loading of JS.

  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 wish I was born in such a culture. I've been trying to teach my father I'm not comfortable with being patted on my laps, back, hugged or generally needlessly touched, since I was 7 at least (25 now). I'm not very hopeful that will ever work. At least I got the little success of stopping my relatives from trying to kiss me on cheeks. For me such gestures are really reserved for intimate relationships in intimate moments.

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

There is ongoing work to generalise ? operator in Rust with traits[1]. If it succeeds, current code is not going to be obsoleted by the new solution, only extended.

[1]: <https://doc.rust-lang.org/std/ops/trait.Try.html>

comment 4y ago · link · parent

That and I think I've read somewhere Bryan Cantrill saying they want to move from Twitter Spaces to something else, so for now it's finished, and they're going to make another thing, similar to how they dropped On The Metal. I may be mistaken though, since I can't find it now. Edited the post to clarify my uncertainty.

comment 4y ago · link · parent

The Array Cast - an array programming podcast (sometimes featuring core people involved in the languages): <https://www.arraycast.com/episodes>

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.)

comment 4y ago · link · parent

Makes sense. So if somehow the companies were somehow forced to brand their products accurately, the problem would have a chance of getting solved thanks to customers.

comment 4y ago · link · parent

> but it seems to be for the greater good.

Exporting blame abroad is for the greater good?

comment 4y ago · link · parent

No such mustard where I live. Tomorrow I'm going to a BBQ though, so I'm going to buy a whole set of mustards and let the best one win. I'll remember to get some Russian ones.

comment 4y ago · link · parent

What particular mustard do you have in mind? The Russian/Ukrainian mustards I've tried couldn't hold a candle to Dijon. Too tame.

886.

Browsers don't like their windows too big

2 points · by GrumpySloth · 4y ago · discuss

comment 4y ago · link · parent

glibc qsort's implementation is in libc.so, not in the header. GCC doesn't have anything to work with.

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

Rust:

  struct Example<const N: usize> {
      pub e: [i32; N],
  }

comment 4y ago · link · parent

No-pause GC is possible, when we're talking about concurrent GCs, but it also shouldn't be mistaken for a "no-overhead GC". And reference-counting, as long as the actual reference counting isn't done in a separate thread as well, instead of blocking in a destructor, which triggers other destructors, is not a no-pause GC. It's true that application developer can avoid pauses even then, but that's a different claim.

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

Well, you do awesome work. I can only hope to maybe one day do anything as cool as you routinely do.

comment 4y ago · link · parent

So, as I understand it, you avoid pauses by avoiding data structures with long chains of pointers. The same will work equally well in a language with a GC. It's also not the case that reference-counting itself doesn't result in pauses itself, but that the user is responsible for using such data structures that they do not result in pauses. Which I think is the only way when you care about performance, no matter whether you use manual memory management, reference counting or a tracing GC, so that's by no means a criticism of you or your language, I think it's very sensible. But I think that describing it as a no-pause memory management mechanism is a mischaracterisation.

comment 4y ago · link · parent

So just like with tracing GCs. You do have a pause, which you may avoid with parallelism, or smear out incrementally. If you do it in parallel, your reference counting needs to be atomic, which adds further overhead. You still need to perform all the reference counting operations for each element of the list, not just free them, because part of the list may be shared. E.g. in SML:

  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

What happens in your language when a linked list is freed? Doesn't running its destructor (or its equivalent) take a linear amount of time relative to the length of the list?

comment 4y ago · link · parent

That's not the only version of success as understood by the West. There is also scientific success. I think most people would agree that winning the Fields Medal is a great success, not due to the money involved (which isn't little, but neither is it a fortune), but due to the accomplishment. Case in point, most people would say that Grigori Perelman is a successful mathematician: he refused to accept prizes such as the Fields Medal or the Millennium Prize. Similar goes for chess champions, athletics champions, all sorts of sports champions.

comment 4y ago · link · parent

A GUI can draw vector graphics, like lines, arcs, arrows etc. GVim still behaves like a terminal, which just has a grid of characters to work with. Any such vector graphics is done awkwardly with fonts, which doesn't give the best result, and patching fonts is not the best UX.

comment 4y ago · link · parent

I was mostly thinking about Neovide[1], which is active, but I've read somewhere that Neovim was planning on not supporting this idea (of multiple GUI frontends) and that they were going to focus on the terminal UI. Maybe that was wrong though, since it's still listed on the Wiki you linked, and Neovide is still getting new commits.

[1]: <https://github.com/neovide/neovide>

1
293031
55