#prog #rust #rustlib #article
Move Constructors in Rust: Is it possible?
TL;DR You can move-constructors the Rust! It requires a few macros but isn’t much more outlandish than the
---
Move Constructors Revisited
Или как убрать UB, связанное с требованиями
Move Constructors in Rust: Is it possible?
TL;DR You can move-constructors the Rust! It requires a few macros but isn’t much more outlandish than the
async
pinning state of the art. A prototype of this idea is implemented in my moveit crate.---
Move Constructors Revisited
Или как убрать UB, связанное с требованиями
Pin
.
Блог*
#prog #rust Полку const-инициализируемых коллекций прибыло. github.com/rust-lang/rust/pull/102197
> полку <...> прибыло
Кажется, моё подсознание хочет мне что-то сказать
Кажется, моё подсознание хочет мне что-то сказать
😁4😱3😢1
Forwarded from Сельский блог 🍁
This media is not supported in your browser
VIEW IN TELEGRAM
Как он мило потянулся своими лапками 🥺
😍8😱3🥰2❤1👍1🔥1🤩1
#prog #performancetrap #article s от небезызвестного Daniel Lemire
Mispredicted branches can multiply your running times
Benchmarking is hard: processors learn to predict branches
(thanks @al_tch)
Mispredicted branches can multiply your running times
Benchmarking is hard: processors learn to predict branches
(thanks @al_tch)
🔥2👍1
Я — взрослый, самостоятельный мужчина. Именно поэтому я купил себе сладостей на две тысячи
🥰22👍3🔥1
#prog #c #cpp #article
The Usual Arithmetic Confusions
There are a lot of aspects of C++ that are not well understood and lead to all sorts of confusion. The usual arithmetic conversions and the integral promotions are two such aspects. Certain binary operators (arithmetic, relational and spaceship) require their operands to have a common type. The usual arithmetic conversions are the set of steps that gets operands to a common type. While the integral promotions brings integral types smaller than int and unsigned int to either int or unsigned int depending on which one can represent all the values of the source type. This is one of the areas in C++ that comes directly from C, so pretty much all of these examples applies to C as well as C++.
We will see some examples with results that many may find surprising. After seeing some of these cases we will discuss the rules and how they explain each case. While covering each rule we will present examples to clarify the rule.
The Usual Arithmetic Confusions
There are a lot of aspects of C++ that are not well understood and lead to all sorts of confusion. The usual arithmetic conversions and the integral promotions are two such aspects. Certain binary operators (arithmetic, relational and spaceship) require their operands to have a common type. The usual arithmetic conversions are the set of steps that gets operands to a common type. While the integral promotions brings integral types smaller than int and unsigned int to either int or unsigned int depending on which one can represent all the values of the source type. This is one of the areas in C++ that comes directly from C, so pretty much all of these examples applies to C as well as C++.
We will see some examples with results that many may find surprising. After seeing some of these cases we will discuss the rules and how they explain each case. While covering each rule we will present examples to clarify the rule.
Shafik Yaghmour's Blog
The Usual Arithmetic Confusions
Blog about C++, C, Undefined Behavior and Compilers
👍4
Forwarded from мне не нравится реальность
а вафель тем временем преодолел отметку в 100
rust-lang/rust
PR'ов 🦀🦀🦀🔥22
мне не нравится реальность
а вафель тем временем преодолел отметку в 100 rust-lang/rust PR'ов 🦀🦀🦀
А Вафель ещё не верил, когда я ему говорил, что он лучше меня, как Rust-разработчик
👍4💩4
#prog #rust #article
Пара статей про опыт использования Rust в проде.
Первая, от января 2017 года — Rust at OneSignal (актуальной на тот версией Rust была 1.5). Даже не смотря на очевидные на тот момент слабые моменты Rust (большинство из которых в настоящий момент не актуальны), в целом статья позитивно отзывается о решении переписать имеющийся изначально код с Ruby на Rust:
We've had fantastic results building one of our core systems in Rust. It has delivered many billions of notifications, and it's delivering more and more each day. We hope that sharing our experience as early adopters in the Rust ecosystem will be helpful to others when making similar decisions. We've certainly found Rust to be a secret weapon for quickly building robust systems.
Вторая статья была опубликована четыре года спустя: Four Years of Rust At OneSignal. В ней отмечается, что за это время поменялось в Rust (главным образом стабилизировали async/await) и как это сказалось на том, как они пишут код.
Пара статей про опыт использования Rust в проде.
Первая, от января 2017 года — Rust at OneSignal (актуальной на тот версией Rust была 1.5). Даже не смотря на очевидные на тот момент слабые моменты Rust (большинство из которых в настоящий момент не актуальны), в целом статья позитивно отзывается о решении переписать имеющийся изначально код с Ruby на Rust:
We've had fantastic results building one of our core systems in Rust. It has delivered many billions of notifications, and it's delivering more and more each day. We hope that sharing our experience as early adopters in the Rust ecosystem will be helpful to others when making similar decisions. We've certainly found Rust to be a secret weapon for quickly building robust systems.
Вторая статья была опубликована четыре года спустя: Four Years of Rust At OneSignal. В ней отмечается, что за это время поменялось в Rust (главным образом стабилизировали async/await) и как это сказалось на том, как они пишут код.
Customer Engagement Blog
Rust at OneSignal
Read all about our blazing fast Push Notification delivery system, OnePush, which is written in The Rust Programming Language.
👍2🔥1
Forwarded from Смирнов
Территории мы оставляем временно, наша армия скоро перейдет в решительное наступление. Надо только избавиться от генералов старой школы, нужны новые волевые офицеры, способные возглавить армию. От старых генералов только предательство и неумение воевать. Лидер страны понимает это как никто другой и лично руководит военными операциями.
Все проблемы из-за отсутствия дисциплины как на фронте, так и в тылу. Многие в тылу до сих пор не понимают, какую мы ведем войну и нужно напрячь все силы, чтобы победить. У нас большая армия и стальная воля.
Но почему мы продолжаем отступать, где армия, где новейшее оружие, про которое нам говорили в последние годы? Неужели этого всего нет? Но ведь нам десять лет говорили, что такое невозможно и мы разобьем любого врага.
Надо немного подождать и мы точно сможем разбить врага – повторяет пропаганда. Тем временем все больше и больше людей задавали вопросы, почему так происходит на фронте. С другой стороны было много тех, кто до сих пор верил властям и был уверен, что ситуация резко изменится.
Это краткое изложение первой части книги Бивора «Падение Берлина», если что
Все проблемы из-за отсутствия дисциплины как на фронте, так и в тылу. Многие в тылу до сих пор не понимают, какую мы ведем войну и нужно напрячь все силы, чтобы победить. У нас большая армия и стальная воля.
Но почему мы продолжаем отступать, где армия, где новейшее оружие, про которое нам говорили в последние годы? Неужели этого всего нет? Но ведь нам десять лет говорили, что такое невозможно и мы разобьем любого врага.
Надо немного подождать и мы точно сможем разбить врага – повторяет пропаганда. Тем временем все больше и больше людей задавали вопросы, почему так происходит на фронте. С другой стороны было много тех, кто до сих пор верил властям и был уверен, что ситуация резко изменится.
Это краткое изложение первой части книги Бивора «Падение Берлина», если что
🤔22🤡8👍6🔥1😁1😱1
#prog #rust #article
A little fixed point math for embedded audio
Или как расчитать синусоиду при помощи предрасчитанных значений и целочисленных операций с приемлемой для аудио точностью.
When profiling this approach, My average loop time was now down to 22 cycles per iteration, meaning it would now only take me 970.2k CPU cycles per second, or 1.5% of my total CPU time!
I also checked my approximation against the "real" floating point sine operation, and found a maximum error of 0.012% for any
A little fixed point math for embedded audio
Или как расчитать синусоиду при помощи предрасчитанных значений и целочисленных операций с приемлемой для аудио точностью.
When profiling this approach, My average loop time was now down to 22 cycles per iteration, meaning it would now only take me 970.2k CPU cycles per second, or 1.5% of my total CPU time!
I also checked my approximation against the "real" floating point sine operation, and found a maximum error of 0.012% for any
i16
value, which is more than close enough for my ears!Jamesmunns
A little fixed point math for embedded audio
Recently, I wanted to generate some sounds for MnemOS, and I wanted it to go fast.
This is a little mini-blog post describing how I did that using fixed point math, and reduced the total CPU usage to about 20% of the original amount.
This is a little mini-blog post describing how I did that using fixed point math, and reduced the total CPU usage to about 20% of the original amount.
🔥4