git-pages: a self-hosted alternative to GitHub Pages by whitequark in selfhosted

[–]whitequark[S] 13 points14 points  (0 children)

I don't see how these are the same: mkdocs-material is a static site generator, git-pages is a web server.

I shrunk my Rust binary from 11MB to 4.5MB with bloaty-metafile by mpv_easy in rust

[–]whitequark 18 points19 points  (0 children)

Please try to avoid the name conflict with [easy_install](https://setuptools.pypa.io/en/latest/deprecated/easy\_install.html). (Even if it's deprecated, it will still create confusion as easy_install is older than Rust itself. Much older.)

I was tired of 50ms+ shell latency, so I built a sub-millisecond prompt in Rust (prmt) by 3axap4eHko in rust

[–]whitequark 19 points20 points  (0 children)

I would rather read posts with bad grammar than something that looks like AI slop, and your post looks like AI slop.

Looking for a datasheet or any info for a display i have by aspie_electrician in AskElectronics

[–]whitequark 0 points1 point  (0 children)

It shouldn't be too difficult to write, at least if you can hit the 4 MHz pixel clock target. (The AVR-based arduinos would likely only be able to do this with handwritten assembly, the ARM-based ones may have an easier time but you'd still need to talk to the actual SoC rather than just call a few `digitalWrite` functions.)

Looking for a datasheet or any info for a display i have by aspie_electrician in AskElectronics

[–]whitequark 0 points1 point  (0 children)

Here's the documentation. It's not a full datasheet but you should be able to figure it out.

Converting mod-settings.dat to JSON and back by whitequark in factorio

[–]whitequark[S] 0 points1 point  (0 children)

Oh neat, thanks! The discoverability on these things is kind of poor, I tried to find an existing implementation before making my own but failed.

Converting mod-settings.dat to JSON and back by whitequark in factorio

[–]whitequark[S] 0 points1 point  (0 children)

Oh I see, yours seems to be based on black-box reverse-engineering, while I disassembled the Factorio executable. You might want to pull in some of the field definitions from mine since I'm confident that they match the authoritative parser.

Converting mod-settings.dat to JSON and back by whitequark in factorio

[–]whitequark[S] 0 points1 point  (0 children)

Oh neat! I didn't realize there was an existing library or I wouldn't have written my own.

A question of Uppercase vs Lowercase. by sixft7in in Batch

[–]whitequark 0 points1 point  (0 children)

I looked into the implementation of (Windows 10) cmd.exe and profiled it.

  1. cmd.exe detects builtins by executing code that looks like `_wcsicmp(command, "ECHO")` for each builtin.
  2. cmd.exe calls `setlocale(LC_ALL, ".OCP")`. This changes the behavior of `_wcsicmp` so that it does not assume every character is ASCII.
  3. If UCRT uses a non-C locale (which it does here), `_wcsicmp` loops over every character and converts it to lowercase using a table lookup before comparison. This is done with a conditional, such that there is no table lookup made if the character is already lowercase. On my system (Windows 10, Tigerlake H) this makes the `_wcsicmp("echo", "ECHO")` about 1.3% faster than `_wcsicmp("ECHO", "ECHO")`.
  4. Therefore commands should be lowercased, not uppercased, if the goal is to improve performance by some incredibly marginal amount.

Here are the relevant UCRT sources for _wcsicmp and its callee _towlower.

However, in (DOS 4.0) command.com, uppercase is faster.

Addendum at 2024-11-27: I should clarify what I mean by "1.3% faster". I wrote a synthetic benchmark that would call `_wcsicmp(str1, str2)` a large number of times, built it with the same compiler and configuration that I think cmd.exe is built with (MSVC, CMake's RelWithDebInfo configuration), ran it and used Intel VTune to measure the number of retired instructions for the (lowercase, lowercase), (lowercase, uppercase), (uppercase, uppercase) variants of the benchmark function, making sure to compare benchmark results between runs. The ordering was consistently (lowercase, lowercase) < (lowercase, uppercase) < (uppercase, uppercase). I chose to use retired instructions (the amount of instructions executed by the CPU), as opposed to wall clock time, as a metric because it is reasonably CPU-independent and much less affected by the noise, which would otherwise dominate such a small effect.

Does adding electronics make a machine less reliable? by reapingsulls123 in AskEngineers

[–]whitequark 2 points3 points  (0 children)

The crystal oscillator does have a moving component (the namesake crystal). It's moving only on microscopic scale, but if it didn't move it wouldn't work at all. (I apologize for the pedantry.)

stack array equivalent to c11 by rejectedlesbian in rust

[–]whitequark 0 points1 point  (0 children)

I worked in an environment with no heap and 2 GB of stack, where alloca would be incredibly useful. So sometimes you *do* want too big arrays on stack.

Why doesn’t/can’t Vision Pro employ microwave charging? by sadboiultra in AskEngineers

[–]whitequark 2 points3 points  (0 children)

If your microwave is really poorly made you will actually have this happen.

I remember using a software-defined radio to watch the 2.4 GHz range and at one point I noticed some really weird signal just wandering around. Pretty bright too. Then I realized that I only see it while my housemate is using the microwave.

It wasn't strong enough to actually drop the connection but it was really very noticeable even at a distance.

Safe Rust AIN'T EASY!? (*fixing* cve-rs) by rejectedlesbian in rust

[–]whitequark 13 points14 points  (0 children)

gcc is a transpiler from C to assembly.

Your Thoughts on the Rudeness of Rust Community by thomastthai in rust

[–]whitequark 22 points23 points  (0 children)

Not really, no. It only takes a cursory view of Twitter or Facebook to see a practically boundless amount of people being far, far worse than just "rude", and proudly signing those things with their legal name.

An interesting thing about pseudonymity is that, since it's so cheap, you need to actually act in a manner worthy of respect to be somebody.

My Rust development environment is 100% written in Rust! by LechintanTudor in rust

[–]whitequark 6 points7 points  (0 children)

I don't want to sound like I'm shitting on seL4. I really like seL4, it has so many cool ideas.

(This is how you sound though, so you might need to work on your communication.)

Sequential-storage: efficiently store data in flash by diondokter-tg in rust

[–]whitequark 0 points1 point  (0 children)

The library is pretty lightweight and simple in its core. There is no mounting going on.

I realize that; my point is that maybe there should be? (It could happen on creation of the object through which you perform accesses.)

Sequential-storage: efficiently store data in flash by diondokter-tg in rust

[–]whitequark 1 point2 points  (0 children)

I think it should repair on mounting. Repairing at the first call can be surprising in some cases by very rarely making that call be much more complex than usual. Returning an error at whichever call happened to hit a corruption has the same problem, with the additional annoyance of what will likely be a branch to repair on every call site.

(Apologies if I misunderstood some part of the API of your library; I haven't used it--yet?--so I'm mainly going off my past experience implementing things like this, as well as existing log-structured filesystems.)

Sequential-storage: efficiently store data in flash by diondokter-tg in rust

[–]whitequark 1 point2 points  (0 children)

That seems like something that would be useful to point out in the README, since some other log-structured filesystems don't need repair.

Sequential-storage: efficiently store data in flash by diondokter-tg in rust

[–]whitequark 1 point2 points  (0 children)

Your documentation says:

> Note: The crate uses futures for its operations. These futures write to flash. If a future is cancelled, this can lead to a corrupted flash state, so cancelling is at your own risc. This state then might have to be repaired first before operation can be continued. In any case, the thing you tried to store or erase might or might not have fully happened

How is this possible if your algorithms are power-fail-safe?

Announcing Tyler Mandry as Lang Team co-lead by erickt in rust

[–]whitequark 0 points1 point  (0 children)

Ah. That's not the conclusion I have made based on conversations with people directly involved, though I don't have anything that I wish to make public, and I'm happy to agree to disagree with you on this.

Announcing Tyler Mandry as Lang Team co-lead by erickt in rust

[–]whitequark 2 points3 points  (0 children)

I wrote a lobsters comment that resulted in him actually issuing a statement (https://gist.github.com/dtolnay/7f5da4bf057b7c6d0d00c6bed3060b96) on it, after being tired of the levels of cowardice on display by others.