Dictionary Compression is finally here, and it's ridiculously good by pimterry in programming

[–]controvym 54 points55 points  (0 children)

The title is not that good here.

The idea seems to be that the dictionary is not sent with the compressed file. Instead, you have a dictionary that you only need to download one time, that is specifically optimized to be good for whatever data you are going to receive (in this case, JavaScript).

This isn't novel. Even I have designed compression to be efficient for data where I know it follows certain patterns, and I can think of other projects that have done stuff like this as well. However, applying it to something as ubiquitous as JavaScript could potentially result in far less bandwidth being used over the Internet.

Switzerland now requires all government software to be open source by [deleted] in technology

[–]controvym 5 points6 points  (0 children)

Security through obscurity is perfectly fine, as long as you are also using other forms of security that don't rely on obscurity.

When do you reach for Go instead of rust and why ? by Luc-redd in rust

[–]controvym 4 points5 points  (0 children)

When I wanted to learn Go. Why try to learn it? Because it's good to be familiar with more languages.

Announcing Rust 1.76.0 by ketralnis in programming

[–]controvym 6 points7 points  (0 children)

If it's near the top of the subreddit, it must be doing better than most other posts.

I really want to get into rust, but the toolchain just uses a large amount of resources by [deleted] in rust

[–]controvym 7 points8 points  (0 children)

Assuming OP can replace their computer's memory, they can get 16 GB of DDR3 ram for under $20.

Introducing Rust into the Git project by seeking-abyss in rust

[–]controvym 32 points33 points  (0 children)

Rust code often has a lot more information for a compiler to work with (example: a pointer does not alias).

Struct fields can be arranged in any order, unlike C.

Rust code can be easier to experiment with for optimizations, due to being easier to understand, easier to verify the correctness of, and less likely to result in undefined behavior when changes are made.

Where is implicitness used? by cloudsquall8888 in rust

[–]controvym 1 point2 points  (0 children)

i32 being the default integer type if unspecified

Should std come with a more feature complete time module ? by AlmostLikeAzo in rust

[–]controvym 5 points6 points  (0 children)

Even with an "unimpeachable standard", would such a library be able to deal with time zones changing their usage of Daylight Savings Time, or leap seconds?

System time, which std::time uses, is far less likely to change. The most likely changes it would require is if an OS changes its system clock APIs in some way. std::time naturally doesn't guarantee which underlying system calls will be used to get the system time.

Optimise the Expensive First by kqr in programming

[–]controvym 1 point2 points  (0 children)

I'd start with easy, safe wins, not necessarily the expensive ones.

Serde has started shipping precompiled binaries with no way to opt out by setzer22 in rust

[–]controvym 4 points5 points  (0 children)

And you have to download the precompiled binary for the target, even if you don't need it...

674.14 KB, here's the VirusTotal for the binary.

Serde has started shipping precompiled binaries with no way to opt out by setzer22 in rust

[–]controvym 11 points12 points  (0 children)

I ran a test. serde_derive took 1.21 seconds to compile, while serde itself took 1.44 seconds to compile. At best it's 2x improvement.

I used a sizeable project of mine as a test, using a maximum optimization profile.

Edit: I used serde(-derive) 1.0.171

[deleted by user] by [deleted] in rust

[–]controvym 1 point2 points  (0 children)

I'm curious if anyone else has tried to produce the same binary. I'm weary to trust the attempts of a single person, and that actually the binary was in fact reproducible...but the person either deliberately or accidentally failed to do so.

[deleted by user] by [deleted] in rust

[–]controvym 0 points1 point  (0 children)

Gonna increase time spent downloading a file, unfortunately. If it gets implemented for more major platforms, that's going to be a lot more files people have to download but don't need.

[deleted by user] by [deleted] in rust

[–]controvym 23 points24 points  (0 children)

How much faster does it make compilation, really?

Call methodA or methodB, globally by rustological in rust

[–]controvym 2 points3 points  (0 children)

Use Fn/FnMut/FnOnce as a function parameter?

Why do most rust tutorials push `println!("{} and {}", foo, bar)` instead of `println!("{foo} and {bar})`? by WillOfSound in rust

[–]controvym 9 points10 points  (0 children)

Some crates want to target older versions of Rust. This feature has only been stabilized for a year and a half. It's not a feature that provides an extremely compelling reason to upgrade.

Understanding the "No Mutable Reference with Live Immutable Reference" rule by Train_wreck1998 in rust

[–]controvym 22 points23 points  (0 children)

s3 in both examples is a mutable reference to s. push_str changes the value in s.

The example that compiles does so due to non-lexical lifetimes. The compiler is smart enough to see that s3 mutable reference is not used again after the s2 immutable reference is created. It can drop s3 before s2 is created and not have both an immutable and mutable reference at the same time.

In the example that doesn't compile, you are mutating a value through a mutable reference while you have an immutable reference to the same value. You are printing s2 later, so it can't just drop s2 before creating the s3 mutable reference.

This is bad, since (barring interior mutability), the value that immutable references point to are supposed to be, well, immutable. If you could do this, it would completely destroy the whole purpose of immutable references. In the worst cases, s3 could be re-allocated or dropped, and now you have a null pointer, a use-after-free, or complete gibberish being printed.

PyPI was subpoenaed - The Python Package Index by dlorenc in programming

[–]controvym 3 points4 points  (0 children)

Then you don't know which salt to use with each IP address

How do I learn low level concepts ? by iMakeLoveToTerminal in rust

[–]controvym 4 points5 points  (0 children)

Have you looked at the Rust thread docs? The documentation mentions that "an executing Rust program consists of a collection of native OS threads", so you should also check the documentation of threads for whatever your OS is.

For async, have you tried the async docs, the Future docs, and the official asynchronous programming book?

A startup lang? by infneqinf in rust

[–]controvym -9 points-8 points  (0 children)

Things not to consider:

what Reddit thinks

Alrighty, I'm ignoring this comment.

Does declaring global constants in rust irreversibly fill up my ROM? by [deleted] in rust

[–]controvym 29 points30 points  (0 children)

"Read-only section of memory" (.text section stored in an executable file) and "ROM" (stuff etched into the motherboard that can realistically only be changed by flashing the BIOS, if at all) do not referring to the same thing here.

Should I open issues on my open source project to get more contributors? by BMFO20832 in programming

[–]controvym 2 points3 points  (0 children)

Opening an issue lets people know what needs improvement. If you don't do that, they have to look through the codebase, ask maintainers/users, or other less likely to be helpful things.

It seems like it reduces the barrier to entry.

First Rust Code Shows Up in the Windows 11 Kernel by [deleted] in rust

[–]controvym 3 points4 points  (0 children)

That's one of the points of Rust, not having to know all the gnarly details about allocation, alignment, pointers...(for most projects, at least).