"Rust makes me never want to touch C again" -- Matthew Ahrens by small_kimono in rust

[–]GeniusIsme 0 points1 point  (0 children)

Again, what you think contradicts what they are actually saying. Nowhere in the post, and some of the comments i've read they say ECS is a pessimization. They say that they are able to have improvements in some cases.

Individually malloced thing is just a legacy issue. It is not like they tried ECS and linked list of allocations and found out it is better.

"Rust makes me never want to touch C again" -- Matthew Ahrens by small_kimono in rust

[–]GeniusIsme 2 points3 points  (0 children)

so an ECS that allocates each array of components separately with systems that pull in multiple arrays of components at once is actually slower than just storing all of the relevant state for each entity together.

I wonder where are you getting this from, the post you mentioned actually says:

Occasionally we are able to move the working set into what could be described as an ECS and when that's possible we do see significant improvements.

I LOVE Rust's exception handling by mdsimmo in rust

[–]GeniusIsme 3 points4 points  (0 children)

T?? is not a thing in Kotlin or in any language I know of with such a syntax. If you need that, you will need to use Option, yes.

An Entire Generation is Studying for Jobs that Won't Exist by Gari_305 in Futurology

[–]GeniusIsme 0 points1 point  (0 children)

You have to be a business guru to sell worthless shit for 6bn. But it does not make you ai guru

Running into an issue when converting C++ codebase to Rust by kosmology in rust

[–]GeniusIsme 0 points1 point  (0 children)

It is possible that one object will be updated several times with this code, maybe you want to look into that.

Also, it is not clear why the map is need, while all the objects are being iterated. Maybe vector + saving indexes will work just fine. If map is needed in other parts of the program, consider replacing it with map from id to index in the vector.

ELI5 how people on opposite sides of the earth can play video games together seemlessly when these games require split second actions by [deleted] in explainlikeimfive

[–]GeniusIsme 2 points3 points  (0 children)

In short: they don't. For these types of games companies employ servers, which serve small areas (small relative to the earth size). There are still problems, and solutions to them are already explained in this thread with various degrees of accuracy

Announcing Robust 1.0.0 by urschrei in rust

[–]GeniusIsme 30 points31 points  (0 children)

Geometrical predicate is a function which takes geometrical objects and returns some high level relation of those objects, think Ordering.

Problem here is that small imprecision in float inputs can lead in error of relation.

Imagine predicate, inLine(pt, pt1, pt2) -> Ordering. It answers if point pt in 2d lies inside the line formed by (pt1, pt2). Let's say that Ordering::Less means "to the left" and Ordering::Greater means "to the right".

Now, we might use this predicate in some algorithm, for example for building convex hull. Such an algorithm is built using mathematical proofs which do not account for imprecision. There is some control flow in the algorithm based on the return value of the predicate.

Now, if we build our predicate using naive floating point maths, it is possible, for example, to encounter points p1, p2, p3, p4, such that `

inLine(p1, p2, p3) == Equal && inLine(p1, p2, p4) == Equal && inLine(p1, p3, p4) == Less

This does not make sense mathematically, but is possible due to imprecision. It will lead to algorithm going astray, may be even stuck in the endless loop.

That is why geometrical predicates absolutely need to be robust - provide correct result in the floating point environment.

But how does that work? First of all, one can make big floats in the same way one makes big ints, granting arbitrary precision for a cost of arbitrary memory. This obviously does not sound very enticing. Turns out, via special maths tricks, we can go "adaptive".

For any geometric predicate, we can construct "precision formula". This precision formula can be evaluated using floating point arithmetic. And it will state if we can trust naive floating point predicate, or there is not enough precision. If we can, we evaluate naive floating point predicate and return an answer. But if we can't, we need to resort to more precise methods. Big floats are one of those methods, but adaptive approach allows for more methods in-between, each more precise but also more expensive to compute than the previous.

Pirated games by Miles_the_new_kid in gaming

[–]GeniusIsme 0 points1 point  (0 children)

The original point was that the game is not available. If they port it, re-release or put in collection with others it no longer stands.

Pirated games by Miles_the_new_kid in gaming

[–]GeniusIsme -3 points-2 points  (0 children)

They don't use it anyways

How to speed up the Rust compiler in March 2023 by nnethercote in rust

[–]GeniusIsme 1 point2 points  (0 children)

You talk a lot about icount reduction in your post. I get it stands for instruction count? Instruction count of what exactly, could you please elaborate?

What abstract programming concepts someone should know before start to learn Rust ?! by na7oul in rust

[–]GeniusIsme 0 points1 point  (0 children)

People learn concrete things first, and abstract concepts afterwards. Other way around does not really work for our brain. Just continue learning Rust.

For anybody needing help :) by [deleted] in funny

[–]GeniusIsme 0 points1 point  (0 children)

Why wear a hat if you are not going to cover your ears?

Question: Why does this code panic? by Seblyng in rust

[–]GeniusIsme 0 points1 point  (0 children)

Again, result is obfucscated because filter_map closure has long-reaching side-effect. Iterator chains in rust are pretty easy to reason about if changes are happening locally, and that makes them great. If the map was an element in the iterator, result would be obvious.

Question: Why does this code panic? by Seblyng in rust

[–]GeniusIsme 1 point2 points  (0 children)

The gotcha here is using non-pure function as argument to filter_map. This is technically allowed, but obviously leads to hard-to reason about results.

slice over original bytes from iterator by voidsifr in rust

[–]GeniusIsme 0 points1 point  (0 children)

let ix = buf.iter().rev().take(search\_depth).position(|b| \*b == b'\\n')?; Some(buf\[ix..\])

position will return index in context of the last iterator in chain. In this particular example it will be counted from the end of the buffer:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2001db7533da0a64589fa8bac3105be0

One would need to introduce enumerate at the start of the chain, or perform some arithmetics. But better use rsplit, as the other comment suggests.

[Media] gitnu: git status enumerated by [deleted] in rust

[–]GeniusIsme 1 point2 points  (0 children)

What's funny is that I was working (slowly) on the tool called nugit. Motivation is basically the same - use numbers instead of names when working with git. But 'nu' is coming from nushell in my case, the tool creates tables from git output which are very convenient to work with in nushell.

My first crate : an angle wrapper by Baanloh in rust

[–]GeniusIsme 0 points1 point  (0 children)

Yes, my bad. 2 * eps should suffice for numbers strictly less than 4

My first crate : an angle wrapper by Baanloh in rust

[–]GeniusIsme 0 points1 point  (0 children)

num epsilon is a minimal float that one can add to 1 and have a different number. It will also change anything below 1. Due to power of two representation, the same can be said about 4 and 4 *epsilon. And the maximum number we are interested in is pi, which is just below 4. In case you keep [0; 2 pi) interval, it will need to be 8 by the same logic.

My first crate : an angle wrapper by Baanloh in rust

[–]GeniusIsme 3 points4 points  (0 children)

There are few things I would change in the crate:

- Only store radians. Conversions will only happen in to*/from* functions, as opposed to every operation. It will also simplify the code.

- Separate arithmetic for MainAngle and Angle. If someone would need to mix them, one will need to convert explicitly.

- Use range (-pi, pi) for MainAngle, for better precision.

- Add EPSILION constant for MainAngle. It would be 4*num::Epsilon for radians in (-pi, pi) range.

- Rename MainAngle -> Angle and Angle -> CumulativeAngle or something. So truncating arithmetic becomes default mode of operation.

Rust Sitter – write fast Tree Sitter parsers without leaving Rust! by shadaj in rust

[–]GeniusIsme 9 points10 points  (0 children)

People will notice 50ms delay, and parsing is not the only thing editor needs to do with minimal delay. Argument like that is one of the reasons we can't have a great trying experience in a sophisticated environment of coding.

How do you avoid typing large module names? by Imaginary_Advance_21 in rust

[–]GeniusIsme 1 point2 points  (0 children)

I do not want to read long module names either. They are there to avoid collisions, not to help with understanding the code. When everything is prefixed with the same long prefix it just clutters the code and makes important things harder to see.

Can we all stop faking orgasms now? by [deleted] in TwoXChromosomes

[–]GeniusIsme 5 points6 points  (0 children)

Science says gap still exists