@weilawei@mastodon.online avatar

weilawei

@weilawei@mastodon.online

People are people are people.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

weilawei, to random
@weilawei@mastodon.online avatar

The disassembly of the UTF-8 validator in firefox shows that it uses 1871 instructions. 🤪

Vs the < 400 to do it the completely obvious way or the 45 (plus a small static table, not code) to do it the slightly less obvious way.

https://bjoern.hoehrmann.de/utf-8/decoder/dfa/

weilawei,
@weilawei@mastodon.online avatar

I threw together a godbolt example with the sample code from that link to count instructions. Pretty nice.

(Ignore the unsafe stuff; I'm just counting instructions in the one function decode(), and wouldn't put all that unchecked stuff in production code.

EDIT: Which is probably good since my code--not theirs--has a pretty bad bug in it that doesn't affect instruction count. That's what you get without tests.)

https://godbolt.org/z/48j1bjnce

weilawei, to random
@weilawei@mastodon.online avatar

"Why is my computer using so much RAM?"

a) Stop running 3 or 4 browsers simultaneously; even the things that don't look like a browser might have a full browser under the hood these days. Browsers are memory intensive.

b) It's not using as much as you think. Allocated space that isn't resident in physical RAM has a very low cost unless you're actually out of physical RAM. Dynamic libraries that aren't in use will contribute to virtual memory, but not resident memory: browsers link a bunch.

weilawei,
@weilawei@mastodon.online avatar

Where SHTF is when you run out of physical RAM to page in the virtual allocations. Until then, it's all gravy.

For instance, this box has no swap. It's disabled. If I actually ran out of memory for the kernel, it would panic and hard lock.

Fortunately, this is very unlikely in modern systems, and the OOM killer will terminate misbehaving userland apps--and this is a good thing, because it rescues the part of the system that matters for continued operation.

weilawei,
@weilawei@mastodon.online avatar

One of the things you should do when stress-testing code is deliberately run it up against the OOM killer. Make sure there's no landmines for future runs.

For testing, I want to use completely unreasonable workloads that nobody would ever actually want to run in practice and make sure it runs fine anyway.

If they do, then they probably have bigger issues than the performance of my code.

weilawei,
@weilawei@mastodon.online avatar

Writing fast code doesn't have to be rocket science. It mostly consists of

a) doing things in a direct way, in as straight a line as possible, and

b) measuring to make sure something really round-about isn't being done.

I'd argue that's just the basics, not premature optimization (an overabused quote, imo).

After measurement, if the direct way is still too slow, then you can write a faster version. Just don't sacrifice basic efficient movement.

weilawei,
@weilawei@mastodon.online avatar

Most modern compilers will optimize away simple inefficiencies in your code, if it's very direct/straight-line. It's when you get really clever (and don't get it right) that the compiler starts spitting out terrible code.

It is, in fact preferable, to write the less efficient version iff it's that much clearer and you have checked the output to make sure it was optimized.

That also implies you should understand the layers below the language you're working in. The stuff your code runs on.

weilawei,
@weilawei@mastodon.online avatar

Anything that's too clever to be turned into the clever form by an optimizing compiler should probably have more documentation comments than actual code.

I can tell you that comparing bytes to -65 is a fast way to differentiate UTF-8 leading bytes from continuations; but that's a trick no compiler will do for you, because it involves treating one kind of data as another, seemingly unrelated type. So that code warrants a big comment explaining how it works.

weilawei, to random
@weilawei@mastodon.online avatar

Slack is taking the approach of, "we know people would opt out, so we made it impossible without switching to a different product."

This is almost somehow worse than not offering an opt out, because Slack is also insulting their customers.

weilawei, to random
@weilawei@mastodon.online avatar

All that tech being used to murder Palestinians is coming home to be used on you.

weilawei, to random
@weilawei@mastodon.online avatar

Signs your library may not be ready for production usage in the wild:

Your documentation doesn't say what file(s) to include or import.

Your examples use types and functions you don't explain anywhere.

weilawei, to random
@weilawei@mastodon.online avatar

So we have pro-genocide billionaires with connections to the Israeli government causing US police officers to commit violence against US citizens.

People need to be tried for this. Specifically the foreign agents.

weilawei, to random
@weilawei@mastodon.online avatar

For a variety of reasons, I don't use the Ubuntu version of firefox, namely it's snap and it locks down the preferences by creating these policy files. No bueno. I just use a downloaded build from Mozilla directly.

New problem discovered: moving the binary itself breaks its ability to find the profiles.

Not moving the profiles, which would make sense. Moving the binary itself.

JFC, why people? What on earth motivated a design so broken? headdesk

weilawei, to random
@weilawei@mastodon.online avatar

That was frustrating. VLC opened but the mouse cursor would switch to this giant cursor (clown shoes, like 4x as large as the regular pointer, and a different color) when mousing over the window.

Resetting settings didn't fix it, reinstalling didn't fix it.. going into MATE pointer options, changing the cursor to another one and back did finally fix it.

It worked in every other app and on the desktop; it smells like VLC is doing questionable things behind the scenes (crossplatform, whee).

weilawei, to random
@weilawei@mastodon.online avatar

If the boss has to offer to hire you back, hold their feet to the fire. Ask for triple at a minimum.

If they don't like it, you can remind them that they didn't know your value the first time.

Don't put up with people who fuck with the basics.

weilawei, to random
@weilawei@mastodon.online avatar

I literally never thought I would live in an America where more than half of the people are functionally illiterate. It blows the mind of 4-year-old me, who very much loved books and the adult version still does.

weilawei, to random
@weilawei@mastodon.online avatar

"The Israeli army has been using Lavender, an AI system designed to produce targets for fighter jets and drones to bomb. Researchers have said the system is using various data sets, including people’s use of messaging apps, to decide on targets, which is leading to many innocent lives lost."

You don't think that this is coming home to be used on you, what with the NSA and their fancy little siphon rooms?

I have news for you, and it is not the good kind.

StillIRise1963, to random
@StillIRise1963@mastodon.world avatar

The super illiterate things people say in social media were funny until I understood just how fucking illiterate the nation actually was.

weilawei,
@weilawei@mastodon.online avatar

@StillIRise1963 American "culture" celebrates illiteracy and lack of education. I'm not even talking about formal education necessarily: just appearing like you might have a clue what's going on was enough to have a really rough childhood before, and I can't imagine it's any better now.

Then people who grew up in this environment continue to propagate it as adults, and here we are with more than half of our adult population being illiterate and uninformed about their world.

weilawei, to ArtificialIntelligence
@weilawei@mastodon.online avatar

The first general-purpose programmable digital electronic computer was designed with mouse resistance in mind.

https://inv.tux.pizza/watch?v=EcWsNdyl264

weilawei, to random
@weilawei@mastodon.online avatar

"Unlike countries in Europe, meanwhile, the United States permits manufacturers to “self-certify” they are in compliance with basic safety standards."

Deregulation was a massive failure, and the fact that we let it get into vehicles is pure insanity.

Boeing, Tesla... those execs need to do prison time for willfully negligent murders.

weilawei, to random
@weilawei@mastodon.online avatar

Israel murders honest journalists and then bans them.

Should tell you everything you need to know about that government.

weilawei, to random
@weilawei@mastodon.online avatar

Whatever algorithm Steam is using to validate downloaded game content is terrible.

It's going at ~0.5 MB/s. I don't know what algorithm they're using, but that performance is garbage.

This machine bottlenecks on the drive at ~6 GB/s, RAM at ~18 GB/s, and a CPU core at 126 GB/s (if you're making use of all the AVX2 ports).

The same thing applies to when Steam launches. I get a full 5 minutes of cursor stuttering and the system is unusable.

weilawei,
@weilawei@mastodon.online avatar

I'm not even sure what we're paying for with newer computers, because the software is literally getting slower.

I hate to admit it, but Niklaus Wirth was right and Joe Armstrong was wrong (on this particular point).

Joe said wait 10 years if you wanted your code to run faster. Niklaus said in 10 years people will have written even slower software.

Wirth's Law wins this round.

weilawei,
@weilawei@mastodon.online avatar

@VikingChieftain 🤪

I wonder if that's to do with a lack of awareness: not understanding the steps that have to be followed in hardware for a given statement in a program.

weilawei,
@weilawei@mastodon.online avatar

@VikingChieftain I have an idea:

Give students a problem to solve. Then, take away their computers. Entirely.

Yes, take them entirely away, and do not let them touch a "computer".

Then, tell them to grab the nearest pile of rocks; arrange those and manipulate them to solve the problem.

I think teaching computers/programming from high level to low level is bass ackwards.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • rosin
  • thenastyranch
  • Durango
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • cisconetworking
  • Youngstown
  • mdbf
  • slotface
  • osvaldo12
  • GTA5RPClips
  • kavyap
  • megavids
  • InstantRegret
  • everett
  • cubers
  • vwfavf
  • normalnudes
  • tacticalgear
  • tester
  • ethstaker
  • khanakhh
  • modclub
  • Leos
  • anitta
  • JUstTest
  • All magazines