antimidas

joined 2 years ago
[–] antimidas@sopuli.xyz 5 points 3 months ago* (last edited 3 months ago) (6 children)

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);
}
[–] antimidas@sopuli.xyz 6 points 3 months ago

Thanks for the suggestion – I'll have to give a try to the ungoogled version.

[–] antimidas@sopuli.xyz 1 points 4 months ago

Yep, I don't think the A55 is the culprit either – just outlined the reasoning behind that. Sometimes pairing also gets things wrong which leads to the headphones using an older protocol version.

But that doesn't seem to be the case as it's using SSC, at this point I'd also just guess it's a bad battery. You can try pairing them again but I wouldn't be surprised if it doesn't help. Still, couldn't really hurt to try.

[–] antimidas@sopuli.xyz 2 points 4 months ago (1 children)

Onkohan tuolla ollut jokin päivitys tms. käynnissä, sillä itsellä nuo siirtolapuutarhan omat sivut näyttäisi avautuvan ihan ongelmitta. Näyttäisi olevan perus esittelyä, kuvia ja puolustuspuheenvuoro puutarhan säilyttämisen puolesta.

Jotenkin tulee sellanen fiilis tuosta uuden sisäänkäynnin vastustamisesta, ettei haluta läpikulkua puutarhan kautta. Puistopuutarha kieltämättä kuulostaa sellaselta minkä läpi ois mukava kulkea muuten vaan cittarissa käydessä, ja ehkä kaupungillakin on siinä vähän sen tyyppinen ajatus taustalla.

[–] antimidas@sopuli.xyz 3 points 4 months ago

Tavallaanhan sähköposti kärsii samalla tavalla avoimen federoinnin ongelmista, kuten ajoittain liian herkästä defederaatiosta. Asiasta saa hyvän kuvan kun kokeilee pistää oman sähköpostipalvelimen pystyyn ja huomaa, miten vaikeaa niitä viestejä on oikeasti saada lähtemään muille palvelimille niin, että menee oikeasti eteenpäin. Samasta syystä moni palvelu pyytää edelleen tarkistamaan roskapostin joidenkin aktivointiviestien yms. varalta, kun omat sähköpostipalvelimet merkataan usein roskapostiksi, jos nyt edes kulkee vastaanottajalle asti.

Toki mitä nyt on noita estolistoja Lemmyssä katsonut, niin suurin osa estetyistä instansseista on sitä hyvästä syystä. Änkyrävasemmiston (tankies) ja muiden instanssien välinen estojen taistelu on sitten asia erikseen, ja vaikuttaa herättävän aika vahvoja tunteita säännöllisin väliajoin, suuntaan ja toiseen 😅

[–] antimidas@sopuli.xyz 1 points 4 months ago (2 children)

But I've previously encountered multiple cases of people complaining headphones not being able to match the advertised battery life – and the reason ended up being either too old a phone (meaning it lacks the newer codecs and versions for Bluetooth), or some bug in pairing leading to using the wrong codecs and/or protocol

[–] antimidas@sopuli.xyz 1 points 4 months ago* (last edited 4 months ago) (4 children)

Couple things I could think of, that can lead to this sort of behavior:

  1. Using them in a cold environment, like -20 to -30 degrees Celsius.
  2. Headphones dropping down to an older standard for some reason, and connecting e.g. via bt 4.x or using an incorrect codec (would explain why one of them is draining so much faster) – should be possible to check in BT settings
  3. The headphones just have a bad battery, I've run into multiple headphones which just turn off once the battery reaches 50-60 %, especially when it's cold out

But these are just suggestions and speculation, I'm not really an expert on the subject.

[–] antimidas@sopuli.xyz 1 points 4 months ago

Doesn't support WiFi 6 on mikrotik you mean? As I'm currently running Openwrt on some bottom-shelf Asus routers and WiFi 6 works just fine.

[–] antimidas@sopuli.xyz 2 points 4 months ago

Yep, got myself a Jääkäri S after getting fed up with backpacks breaking all the time. This time it actually seems like it can stand up to the test of time and lugging two laptops around everywhere.

Whatever the brand, one thing to keep in mind is the material. Nylon (polyamide) can take much more abuse than e.g. polyester. Good if the bag bottom is as continuous as possible instead of being held up by seams. Savotta also adds reinforcement on the bottom so it doesn't wear as much from weight.

If you happen to be in Finland it's Jääkäri S currently on sale in Motonet for 90 € – not sure if they ship elsewhere in Europe though.

[–] antimidas@sopuli.xyz 2 points 4 months ago

Good link that, I'll have to add those flags to my list of aliases

[–] antimidas@sopuli.xyz 23 points 4 months ago (3 children)

The more frustrated you are when running git blame the more likely the command turns out to be a mirror.

[–] antimidas@sopuli.xyz 7 points 4 months ago (2 children)

Wouldn't be surprised if he'd take the comparison as a compliment

view more: ‹ prev next ›