snaggen

joined 2 years ago
27
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 

TL;DR: On Linux, if you have Transparent Huge Pages enabled, you can try to run cargo with the environment variable MALLOC_CONF="thp:always,metadata_thp:always" for a potential ~5% speed boost.

 

Just want to do a shout out to @[email protected] about the breaking changes in the upcoming Lemmy 19, since I haven't seen any mention about it here.

11
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
 

I have seen posts that the rust project was setting up it's own Mastodon instance, and now it seems to be live. I assume we will se some official Rust news being posted on this account soon. And hopefully there will be other interesting accounts to follow on this instance in a not so far future.

[–] [email protected] 1 points 2 years ago

Yes, you have a point. However adding heat is often implicit when talking about melting stuff. However, if it requires 3400C, then the answer would probably include a comment about that.

[–] [email protected] 11 points 2 years ago* (last edited 2 years ago) (3 children)

Well, I agree. But what I mean is that when people ask physics questions, it is often implicitly understood to mean under current conditions. You rarely hear normal people or kids (who I find asks most of the physics question) include anything about frictionless vacuums in the question. (For reference: https://xkcd.com/669/ ). So, for the egg question, regular people would most likely consider the answer to be "No, except under very special circumstances". But, I agree with you that if a simple Yes/No answer is expected, it have to be Yes.

[–] [email protected] 24 points 2 years ago (5 children)

Well, for eggs, that are carbon based, you will in fact have problems since carbon doesn't have a liquid state at regular atmospheric pressure. I guess you can add pressure, but is that really what we mean when asking a question if something melt?

[–] [email protected] 8 points 2 years ago (2 children)

It might be interesting to watch the Jackie Chan episode of Every Frame is a Painting, for an analysis of the difference between Hollywood and Hong Kong. This will explain why Jackie Chan is so much better in his Hong Kong movies.

https://m.youtube.com/watch?v=Z1PCtIaM_GQ

[–] [email protected] 2 points 2 years ago (1 children)

That is all dependent on the program, but the simplest scenario is by an API with two requests at the same time. But it may also be like if you scan for new files, and use inotify, then you may also have a scanning loop as a fallback. Then the scan and inotify may trigger at almost the same time, so if that then results in a db create or insert you can get in to this problem. So, there are multiple ways to get in to trouble, and life always find new ways 😀

[–] [email protected] 5 points 2 years ago

You are free to see this as an ad, but as Rust is targeting safety critical programming in general, I find it interesting to follow certification efforts like this to make rust available for really safety critical use cases. Now, the Ferrocene project is contributing back, but that fact or the license does not really affect the relevance for this community.

[–] [email protected] 13 points 2 years ago (7 children)

Well, of course you should stick to rustc if you don't need the certification. I get the impression you mix up thing and the purpose of a certified compiler.

Ferrous Systems is working on certifying a specific version of rustc, and hence make it possible to use rust for projects where such certification is required. And certification is required for things like programming medical equipment. If you are hooked in to life support, it is good if the compiler did the thing it was supposed to do.... a crash in such programs can be fatal in a very literal way.

Also, notice that they try to do this without forking and by contributing upstream.

[–] [email protected] 3 points 2 years ago (2 children)

As I still run in to glibc version issues a little now and then (admittedly not very often, thankss to containers), I hope to see rust getting rid of libc one day. But I don't expect that in the near future, because as the author mentions, libc is very mature, so replacing it must be done with a lot of caution. But this really looks like a step in the right direction.

[–] [email protected] 7 points 2 years ago (2 children)

I think this is was a great read, since it shows a few important things

  • Coming to rust from C is not trivial, you are required to learn a few new concepts (or not really new, but implicit in most languages, formalized in rust).
  • When coming from C and you understand the basic concepts, it is easier to learn rust than from many other languages, since you understand what is going on under the hood. Dangling pointers, and use after free aso, are known concepts. C/C++ programmers don't have to fear rust.
  • The rust book is a great source of information.
[–] [email protected] 2 points 2 years ago

So, a loop it is....

[–] [email protected] 4 points 2 years ago (5 children)

That will always be prune to race conditions, where you check if someting exists (then some other thread creates it) and then you try to create it. You should always try to create first, then if it fails due to it already existing, fetch it. That is a good general rule for anything from hashmaps to databases.

[–] [email protected] 3 points 2 years ago (2 children)

I have never used sea-orm, but I wonder if .on_conflict could be used to simplify the code above?

view more: ‹ prev next ›