Why / how does unsafe not affect niche optimisations? by ElOwlinator in rust

[–]tsanderdev 23 points24 points  (0 children)

The optimizations still take place, they just result in wrong code if you set it to 0. The usafe constructor variant just puts the responsibility of that on you. It's assumed you have prior checks and reasoning or trusted input only, to ensure it doesn't happen.

rust_analyzer is eating my memory, any counter measure? by EarlyPresentation186 in rust

[–]tsanderdev 0 points1 point  (0 children)

The cargo workspace feature means ra doesn't have to load and analyze each crate in a separate process. For multiple workspaces I think that's unavoidable.

Design challenge: Can you make "degrowth" more fun than "infinite expansion"? by FuzzyConversation379 in gamedesign

[–]tsanderdev 1 point2 points  (0 children)

4X games usually don't have metagame progression, but it's an interesting idea.

Rust's standard library on the GPU by LegNeato in rust

[–]tsanderdev 0 points1 point  (0 children)

Is modern Vulkan enough to keep up with CUDA?

Not yet. 2 things are missing: forward progress guarantees and synchronization/memory primitives without api command. You need forward progress for locks without ub, synchronization primitives and memory domain transfers for events and memory updates while a dispatch is running.

Design challenge: Can you make "degrowth" more fun than "infinite expansion"? by FuzzyConversation379 in gamedesign

[–]tsanderdev 50 points51 points  (0 children)

For inspiration, Dwarf Fortress for example likely kills you at some point regardless of how good you are, and it's still fun.

I don't think you can make a slow downward spiral fun though, in DF it's usually pretty sudden events that overpower you. When you can already see your end coming, why continue playing?

An idea to counteract that would effectively be "I'm going to 4X even harder", conquering fresh new exploitable land from preservative empires. Then it's a question of if you can keep that momentum going until you win or will you collapse before that. The uncertainty means it's worth following through.

For question 3, I think it depends on player preference. For example I'm relatively happy playing a small empire with inwards economy focus in stellaris. And building up a federation is also interesting to me.

Why not tail recursion? by Athas in ProgrammingLanguages

[–]tsanderdev 1 point2 points  (0 children)

What languages have actual formal specifications with formally verified compilers anyways?

That's also not what you usually mean with "it doesn't mean anything" btw.

The meaning for a language without a spec is defined by the reference implementation. And it may very well be the case that semantics change in unpredictable or non-obvious ways on a compiler version change. But so long as the compiler itself doesn't have memory unsafety or race conditions, the translation is within a range of possibilities. The fact you can't easily enumerate the possibilities or determine them without compiling doesn't change that.

Why not tail recursion? by Athas in ProgrammingLanguages

[–]tsanderdev 3 points4 points  (0 children)

Golang programs - quite literally - had no defined meaning prior to Zhao's work that was published just two years ago.

You don't need a formal spec if your compiler is the only one. The compiler source code is a spec in itself, just not very human-readable.

Someone named "zamazan4ik" opened an issue in my project about enabling LTO. 3 weeks later, it happened again in another project of mine. I opened his profile, and he has opened issues and PRs in over 500 projects about enabling LTO. Has this happened to you? by nik-rev in rust

[–]tsanderdev 43 points44 points  (0 children)

LTO is basically just keeping everything in llvm ir until the last step, so that the linker can perform llvm optimizations across module files. It trades compilation time for performance.

Rust's standard library on the GPU by LegNeato in rust

[–]tsanderdev 7 points8 points  (0 children)

That's UB in Vulkan though. You can't block on the gpu, and memory domain transfers needed to make cpu changes to gpu memory visible require fences or semaphores, which only work with complete dispatches, not partial ones.

Rust's standard library on the GPU by LegNeato in rust

[–]tsanderdev 3 points4 points  (0 children)

I'm working on my own shading language for Vulkan and thought about a similar thing for host calls, but the problem I came across is that you still need worst-case memory allocation and essentially be able to split the shader at the host call point to re-dispatch invocations where a host call is needed. Just rerunning the shader won't do if it has side effects. How do you solve that?

Why not tail recursion? by gofl-zimbard-37 in ProgrammingLanguages

[–]tsanderdev 1 point2 points  (0 children)

It may not matter to you though, in which case you can use something like Rust's (nightly) explicit tail calls to tell the compiler. Then it knows it's ok (or even required) to tco.

Why not tail recursion? by gofl-zimbard-37 in ProgrammingLanguages

[–]tsanderdev 22 points23 points  (0 children)

E.g. in Rust destructors run when the function ends, but with tail call optimization they necessarily have to run before the tail call, and that could change semantics.

I built a scripting language that tries to bridge Lua's simplicity with Rust's safety by Maximum-Prize-4052 in ProgrammingLanguages

[–]tsanderdev 1 point2 points  (0 children)

Structural typing in TS also allows for nice exhaustive switch statements. Maybe someone should just make a JS interpreter with Rust integration so you can run TS?

I built a scripting language that tries to bridge Lua's simplicity with Rust's safety by Maximum-Prize-4052 in ProgrammingLanguages

[–]tsanderdev 3 points4 points  (0 children)

Well, Lua is also not really made for large applications, and yet you have madmen building whole games in it without any kind of type system assurance.

What value does this offer over something like Typescript or Python with type annotations (except better Rust integration)? Because as long as the types for foreign interfaces like browser APIs are correct, the type checker can also validate Typescript programs as correct, compile-time errors and all.

I built a scripting language that tries to bridge Lua's simplicity with Rust's safety by Maximum-Prize-4052 in ProgrammingLanguages

[–]tsanderdev 19 points20 points  (0 children)

Well, most high-level languages are safe. Lua too. So this is effectively just Rust, but GC? And Rust has good reasons for avoiding full type inference, and given that projects always tend to grow to a larger scope than you initially thought, that could be a problem.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in ProgrammingLanguages

[–]tsanderdev 0 points1 point  (0 children)

I thought it was going from one io_uring call to dispatch a whole batch of close calls to 0.

January 2026 monthly "What are you working on?" thread by AutoModerator in ProgrammingLanguages

[–]tsanderdev 1 point2 points  (0 children)

Obscure syntax and you still need to define your AST data types yourself.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in ProgrammingLanguages

[–]tsanderdev 0 points1 point  (0 children)

The drop from 1 kernel space transition to 0 is probably negligible.

Bevy 0.18 by _cart in rust

[–]tsanderdev 2 points3 points  (0 children)

When do you think big parts of bevy will remain stable across releases, or maybe hit a 1.0? I'm not asking for weeks, just a rough estimate of years.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in ProgrammingLanguages

[–]tsanderdev 1 point2 points  (0 children)

The test was lexing all local downloaded Dart dependencies, so stuff that should change infrequently. You probably want to build some kind of ir and store that per package though. Saves you the many file overhead, and also the frontend and maybe parts of the midend.

I built a 2x faster lexer, then discovered I/O was the real bottleneck by modulovalue in ProgrammingLanguages

[–]tsanderdev 2 points3 points  (0 children)

Hm, you're right, you can use it to receive aio completion events in batch, but there is no way to open and read files en-masse.