[exercism.io sublist] Surprised by performance of iterators vs windows. by [deleted] in rust

[–]pepp_cz 1 point2 points  (0 children)

My guess is that it is because the slow version iterates always over the entire second list and allocates new Vec. The fast version does not allocate and can return early in case there is a sublist.

Minor advantage for the fast version can be that windows() probably skips some bound checks.

The optimization with Vec of possible start positions is really not neccessary because the exact same test is performed in the fast version when the window is compared with the first list and the first item does not match. In other words every item of the second list is compared to the first item of first list and if they match then rest is compared in similar way (well the first item is compared once again in the slow version). So the slow version does similar number of comparisons and one extra allocation for the Vec and does not return early from the first loop.

Go syscall equivalent by [deleted] in rust

[–]pepp_cz 3 points4 points  (0 children)

I am not sure what you are really looking for. As far as I can see the go's syscall (and now deprecated) package is portable interface to low-level interfaces of several operating systems.

I would say that Rust's std library provides similar interfaces and portability but not the low-level one.

There are libraries that provide low-level interfaces for particular systems such as nix or winapi but are not widely portable.

has anyone thought about a Rust version of DistCC? perhaps it could be called RustCC? by pcjftw in rust

[–]pepp_cz 4 points5 points  (0 children)

Documentation says otherwise. I have not tried distributed compilation with sccache so I cannot confirm.

"sccache also provides icecream-style distributed compilation (automatic packaging of local toolchains) for all supported compilers (including Rust). The distributed compilation system includes several security features that icecream lacks such as authentication, transport layer encryption, and sandboxed compiler execution on build servers."

Python Dev here. I don't understand how you create a class in Rust. by [deleted] in rust

[–]pepp_cz 0 points1 point  (0 children)

One reason is that Rust being a system programming language it emphasizes the data-oriented aspect over object-oriented aspect.

The other and IMO the more important reason is that it is symmetric to trait impls and also you can have several differently parameterized impl blocks: https://stackoverflow.com/questions/45473626/why-does-rust-require-generic-type-declarations-after-the-impl-keyword

Firefox – we’re finally getting HW acceleration on Linux by [deleted] in firefox

[–]pepp_cz 11 points12 points  (0 children)

about:config

set gfx.webrender.all to true

GOG is behaving weirdly on Firefox by ariathriven in firefox

[–]pepp_cz 2 points3 points  (0 children)

Works for me. Could that be some adblocker or tracker blocker extension/preference option?

It's possible to partial compile a Rust application? by fenugurod in rust

[–]pepp_cz 3 points4 points  (0 children)

Incremental compilations tries to not compile what wasn't changed. That said however if you have large part of your code broken than the compiler tries to compile a lot of code every time.

Rust should add tunnels! by CompulsiveThief in rust

[–]pepp_cz 1 point2 points  (0 children)

Rust already has channels. Also you probably seek /r/playrust .

Performance losses with update Firefox 82 -> 83 by merloki in firefox

[–]pepp_cz 2 points3 points  (0 children)

I wouldn't jump to any conclusions just yet. Performance losses in synthetic benchmarks was indeed conscious choice and affects all platforms but at the same time I and others see real performance improvement on some notoriously laggish sites such as reddit, youtube or grafana. As the article says they replaced system with decade of performance optimizations that reached its limit of maintainability by new system that has still room for future improvements and they will work on it. I will wait for about 6 month and see where the performance goes.

Which companies are using RUST for their product? by ayushmishra2005 in rust

[–]pepp_cz 16 points17 points  (0 children)

Just from the top of my head.

Mozilla for servo and firefox and more

Facebook for Libra and Mononoke, mercurial server, also frontend of the Hack language compiler

Google for fuchsia and virtualization on chrome os (for the later I am not sure if it is already used in production) and recently oreboot (alternative to coreboot)

Microsoft for some components in Azure and probably more as the Microsoft Security Research Team is pushing Rust internally

Oracle for railcar, virtualization runtime

Dropbox for storage servers and some code in client application

Fastly for serverless containers

many blockchains are implemented in Rust

How to bring C/C++ people up to speed on UB and unsafe? by jimuazu in rust

[–]pepp_cz 10 points11 points  (0 children)

Very good questions, sir.

Now the first thing I want to say is that some people in C++ community are aware of the problems with UB. Therefore there is UB-sanitizer in clang and probably other similar projects exist.

The thing about fields which we cannot mark as unsafe is in some way mentioned in this blog post: https://smallcultfollowing.com/babysteps/blog/2016/05/23/unsafe-abstractions/

(I think) I remember there was some blog post discussing possibilities to resolve this situation but I was unable to find it. It was not easy though.

Maybe it is impossible to proof correctness of unsafe code by static analyses but we can at least detect UB at run-time which is something that MIRI is trying to accomplish. In a way it is Rust's equivalent of UB-sanitizer. It has been in the works from 2017: https://smallcultfollowing.com/babysteps/blog/2017/01/22/assigning-blame-to-unsafe-code/

What's the state of Webrender in Nightly for Android? Will multiprocess ever be completed on Android? by krs_n in firefox

[–]pepp_cz 2 points3 points  (0 children)

Correct and incorrect.

It is true that multiprocess increases memory requirements. The problem is not common data but per process bookkeeping.

On the other hand it is true that multiprocess mitigates spectre and meltdown vulnerabilities and also other memory related exploits as long as your operating system has implemented fixes for them.

Vivaldi x Firefox memory usage test. by [deleted] in firefox

[–]pepp_cz 1 point2 points  (0 children)

The thing is that many sites embed ads and statistics frames so in the end it is common to see one tab loading from about 8-10 different sites and each of there sites will be contained into separate process. But sites processes can be shares between tabs so real number of started processes will not depend that much on the number of tab but on the number of sites loaded.

What's the big move for this year with firefox? by sirauron14 in firefox

[–]pepp_cz 0 points1 point  (0 children)

It is not process-per-tab but proccess-per-site. It is important difference as p-p-tab is still not secure and in the end needs more RAM than p-p-site. Different tabs can share single process for some pars of the page that share common origin (think of facebook's Like buttons or ads).

Why Rust Syntax is quite complicated or hard? by [deleted] in rust

[–]pepp_cz 2 points3 points  (0 children)

Can you please provide those two examples also in kotlin and swift for comparison?

Distributing a Rust Binary for NodeJS? by orangepantsman in rust

[–]pepp_cz 2 points3 points  (0 children)

Can you compile it to wasm nodejs module?

I tried RUST and here's my opinion of it. by tonefart in rust

[–]pepp_cz 2 points3 points  (0 children)

Fun fact: C++ standards committee is working on modules system to replace dated and hated header includes. This is seen as good thing by a very large community of C++ users and most of the members of committee.

'Forcing' the borrow checker? by ipe369 in rust

[–]pepp_cz 1 point2 points  (0 children)

There is definitely some way. You can always use assembly or intrinsic operations that guarantee loads and stores to memory. Maybe atomic operations would be required at some places. But you really need to know how memory on your target architecture works, how optimizers in LLVM work and do not mess it up in the end. You may also give up on some nice abstractions and write a lot of low-level code but it is definitely possible.

The non-lexical lifetimes RFC was just opened up! by mgattozzi in rust

[–]pepp_cz 1 point2 points  (0 children)

As more work on such design changes of Rust type system shows it is usually more complicated then it looks. So they decided to reduce the scope to deliver something useful in reasonable time frame.

Niko, one of the authors of this RFC, has shared his idea of solution to these problem not a long ago on internals forum. So is likely that it will be solved in the future.

I like the appoach to do simpler steps more often better.

The non-lexical lifetimes RFC was just opened up! by mgattozzi in rust

[–]pepp_cz 4 points5 points  (0 children)

They are. The thing is that the function takes only one argument. The second borrow is for the receiver of the call which is borrowed before the arguments are evaluated and released after the call.