• 1 Post
  • 22 Comments
Joined 2 years ago
cake
Cake day: July 28th, 2023

help-circle

  • Don’t seem to be any disk reads on request at a glance, though that might just be due to read caching on OS level. There’s a spike on first page refresh/load after dropping the read cache, so that could indicate reading the file in every time there’s a fresh page load. Would have to open the browser with call tracing to be sure, which I’ll probably try out later today.

    For my other devices I use unbound hosted on the router, so this is the first time encountering said issue for me as well.


  • You’re using software to do something it wasn’t designed to do

    As such, Chrome isn’t exactly following the best practices either – if you want to reinvent the wheel at least improve upon the original instead of making it run worse. True, it’s not the intended method of use, but resource-wise it shouldn’t cause issues – at this point one would’ve needed active work to make it run this poorly.

    Why would you even think to do something like this?

    As I said, due to company VPN enforcing their own DNS for intranet resources etc. Technically I could override it with a single rule in configuration, but this would also technically be a breach of guidelines as opposed to the more moderate rules-lawyery approach I attempt here.

    If it was up to me the employer should just add some blocklist to their own forwarder for the benefit of everyone working there…

    But guess I’ll settle for local dnsmasq on the laptop for now. Thanks for the discussion 👌🏼


  • TLDR: looks like you’re right, although Chrome shouldn’t be struggling with that amount of hosts to chug through. This ended up being an interesting rabbit hole.

    My home network already uses unbound with proper blocklist configured, but I can’t use the same setup directly with my work computer as the VPN sets it’s own DNS. I can only override this with a local resolver on the work laptop, and I’d really like to get by with just systemd-resolved instead of having to add dnsmasq or similar for this. None of the other tools I use struggle with this setup, as they use the system IP stack.

    Might well be that chromium has a bit more sophisticated a network stack (than just using the system provided libraries), and I remember the docs indicating something about that being the case. In any way, it’s not like the code is (or should be) paging through the whole file every time there’s a query – either it forwards it to another resolver, or does it locally, but in any case there will be a cache. That cache will then end up being those queried domains in order of access, after which having a long /etc/hosts won’t matter. Worst case scenario after paging in the hosts file initially is 3-5 ms (per query) for comparing through the 100k-700k lines before hitting a wall, and that only needs to happen once regardless of where the actual resolving takes place. At a glance chrome net stack should cache queries into the hosts file as well. So at the very least it doesn’t really make sense for it to struggle for 5-10 seconds on every consecutive refresh of the page with a warm DNS cache in memory…

    …or that’s how it should happen. Your comment inspired me to test it a bit more, and lo: after trying out a hosts file with 10 000 000 bogus entries chrome was brought completely to it’s knees. However, that amount of string comparisons is absolutely nothing in practice – Python with its measly linked lists and slow interpreter manages comparing against every row in 300 ms, a crude C implementation manages it in 23 ms (approx. 2 ms with 1 million rows, both a lot more than what I have appended to the hosts file). So the file being long should have nothing to do with it unless there’s something very wrong with the implementation. Comparing against /etc/hosts should be cheap as it doesn’t support wildcard entires – as such the comparisons are just simple 1:1 check against first matching row. I’ll continue investigating and see if there’s a quick change to be made in how the hosts are read in. Fixing this shouldn’t cause any issues for other use cases from what I see.

    For reference, if you want to check the performance for 10 million comparisons on your own hardware:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/time.h>
    
    
    int main(void) {
    	struct timeval start_t;
    	struct timeval end_t;
    
    	char **strs = malloc(sizeof(char *) * 10000000);
    	for (int i = 0; i < 10000000; i++) {
    		char *urlbuf = malloc(sizeof(char) * 50);
    		sprintf(urlbuf, "%d.bogus.local", i);
    		strs[i] = urlbuf;
    	}
    
    	printf("Checking comparisons through array of 10M strings.\n");
    	gettimeofday(&start_t, NULL);
    
    	for (int i = 0; i < 10000000; i++) {
    		strcmp(strs[i], "test.url.local");
    	}
    
    	gettimeofday(&end_t, NULL);
    
    	long duration = (end_t.tv_usec - start_t.tv_usec) / 1000;
    	printf("Spent %ld ms on the operation.\n", duration);
    
    	for (int i = 0; i < 10000000; i++) {
    		free(strs[i]);
    	}
    	free(strs);
    }
    






  • Per text and per minute plans were the norm at least here for a long time, I had one until mid 2010’s IIRC. A single text cost something like 0.069 €. Parents kept their kids from overspending with prepaid plans, which were the norm for elementary students. In Europe people typically don’t pay to receive calls, so your parents could still call you even if you ran out of phone credits.

    We got unlimited data plans before widespread unlimited texting, which meant people mostly stopped texting by early 2010’s. I remember my phone plan getting unlimited 3g in 2010 for 0.99 €/month (approx 1.40 $ back then), albeit slow AF (256 kbps). Most switched to e.g. Kik or later WhatsApp after that.


  • Probably varies a lot based on where you grew up. I got my first phone when I was 9, in 2006, and was among the last in my class to get one. Though phone plans were really cheap by then in Finland, partially due to the largest phone manufacturer (back then) Nokia being Finnish, and our telecom operators being in tight competition. (We’ve three separate carriers with country wide networks, as was the case back in the early 2000’s as well)

    I’d say the turning point here was 2003 when Nokia launched the model 1100, which was dirt cheap. I vaguely remember the price eventually falling as low as 19 € in a sale, at which point the phone cost about the same as your typical phone plan per month.


  • Mayonnaise on pizza is surprisingly common in Finland, e.g one local pizzeria near me puts garlic mayo on certain pizzas – enough that there’s more mayo than tomato sauce. For some incomprehensible reason they also put the mayo under the cheese. As you can guess, it was repulsive. However, BBQ sauce and bacon pizza is a nice combination, which is also normal here.

    Truffle mayo did work in some pizzas, in moderation.


  • Given that there are engineers involved I wouldn’t be at all surprised if that was deliberate. Trying to get potentially offensive or otherwise NSFW acronyms past marketing without them noticing is practically an industry-wide joke at this point, which is why they are so prevalent in the FOSS space. (no marketing staff to complain)

    If that’s true in this case, though, hats off to whoever managed to get it though to official commercial standards



  • Quickly played the storyline of Detroit: Become Human through for the first time, some Dishonored for nostalgia and fell back to playing the PS2 games I never had the console for back when I was a child.

    Most of my recent hours have gone to Rayman 3, and there’s a big heap of PS2 games to go through after that. I’ve noticed PCSX2 doesn’t consume much battery, so my typical travel games tend to be PS2 games as well.



  • SEO is of course a problem, but it’s been a problem for a long time, and there are ways around it for those who know how to seek information. Proper use of keywords, blacklisting sites with known spam information, searching specific sites, mandating specific words and phrases to be contained in the search etc. It’s true, however, that information has become less discoverable during the latest decade – at least reliable information has.

    While AI-written spam articles and such have been a pain sometimes, gatekeeping content is in my opinion as big of a threat to the proper use of search engines for finding information. As more and more sites require you to log in to view the discussion (social media is the worst offender here) much of the search results is unusable. Nowadays the results lead to a paywall or a login wall almost more often than to a proper result, and that makes them almost completely useless. I understand this kind of thing for platforms which pay for creating the content, e.g. news sites, but user-generated content shouldn’t be locked behind a login requirement.

    I fear the day StackOverflow and Reddit decide the users’ discussions should be visible for only logged-in users. Reddit has already taken the first steps with limiting “NSFW” content to logged-in users only (on new reddit). Medium articles going behind paywall also caused some headaches a while back.



  • If you’re using powdered detergent, make sure yours doesn’t have zeolite as the water softening agent. It will deposit in the machine, and starts eventually covering the fabrics with a talcum-like powdery substance. It gets especially bad if you either have to use a lot of detergent because of hard water, or are overusing the detergent.

    Zeolite was brought in to replace phosphates due to environmental concerns, but it has its own problems with the washing results.

    One other thing that often ruins the freshness of clothes for me is overly scented/perfumed detergent. The smell can get quite overwhelming, and contribute to a chemical-y smell and feel.


  • Just in case someone misreads this, add the vinegar as the softener, so it’s not in the first load that contains the detergent. The detergent is a base, and relies upon that fact to get rid of some of the stains, and vinegar as an acid will neutralize that. Vinegar is meant to be in the rinse cycle when washing laundry, where it can help get rid of any extra detergent by neutralizing it and do any other magic it does.

    Also, though I don’t usually encounter them often, do note that vinegar can wash away zinc and silver oxides used for some sterile clothing, and can supposedly damage lyocell.

    But overall I second these suggestions. Most times the amounts listed for detergent are far too big, and you can often get by with less.


  • And we’ve nowadays taken it even further, in spoken Finnish we’ve even got rid of the “hän” and mostly use “se”, which is the Finnish word for “it”. The same pronoun is used for people in all forms, animals, items, institutions and so on, and in practice the only case for “hän” is people trying to remind others they consider their pets human.

    Context will tell which one it is.