#prog #rust #js #article #successstory
Статья о том, как переписали с нуля плеер asciinema на Rust (с компиляцией в WASM) и Solid.js и получили прирост производительности в 50 раз.
(thanks @theLastOfCats)
Цитаты:
"At first I planned to implement the terminal emulation part in Rust without any optimizations, just write idiomatic Rust code, then revisit the tricks from the old implementation. The initial benchmarks blew my mind though, showing that spending additional time on optimizing the emulation part is absolutely unnecessary."
"I still thought I may need to implement some form of terminal state snapshot/restore to support the “seeking” feature. This feature requires feeding the terminal emulator with the whole text stream between the current position and the desired position, or in the worst case when you’re seeking back, feeding the emulator with the whole text from the very beginning of the recording up to the desired position. Optimizing this could be done, for example, by keeping snapshot of the terminal emulator state at multiple time points, sort of like having key-frames every couple of seconds. In ClojureScript implementation this came for free, thanks to the immutable data structures. In the new JS+Rust implementation this would have required extra work, but it turned out, that’s not needed either - clicking on the progress bar in the new player, to jump to the desired time in the recording, results in instantaneous jump, even when it has to feed the emulator with megabytes of data to parse and interpret."
Статья о том, как переписали с нуля плеер asciinema на Rust (с компиляцией в WASM) и Solid.js и получили прирост производительности в 50 раз.
(thanks @theLastOfCats)
Цитаты:
"At first I planned to implement the terminal emulation part in Rust without any optimizations, just write idiomatic Rust code, then revisit the tricks from the old implementation. The initial benchmarks blew my mind though, showing that spending additional time on optimizing the emulation part is absolutely unnecessary."
"I still thought I may need to implement some form of terminal state snapshot/restore to support the “seeking” feature. This feature requires feeding the terminal emulator with the whole text stream between the current position and the desired position, or in the worst case when you’re seeking back, feeding the emulator with the whole text from the very beginning of the recording up to the desired position. Optimizing this could be done, for example, by keeping snapshot of the terminal emulator state at multiple time points, sort of like having key-frames every couple of seconds. In ClojureScript implementation this came for free, thanks to the immutable data structures. In the new JS+Rust implementation this would have required extra work, but it turned out, that’s not needed either - clicking on the progress bar in the new player, to jump to the desired time in the recording, results in instantaneous jump, even when it has to feed the emulator with megabytes of data to parse and interpret."
blog.asciinema.org
4x smaller, 50x faster · asciinema blog
News about asciinema development and new releases
Блог*
Подписчики, дорогие мои, в довольно скором времени будет Rustcon. Мне туда хочется попасть (🧇), но идти просто слушателем не хочется а ещё меня жаба душит отдавать за билет 14 тысяч. Поэтому у меня есть хитрый план: взять один из своих авторских постов в Блог*е…
Я, кстати, там докладчик, так что это ещё и шанс увидеться со мной вживую.
Я бы сказал, какой доклад мой, но вы найдите сами, благо, зная меня, это не сложно.
Я бы сказал, какой доклад мой, но вы найдите сами, благо, зная меня, это не сложно.
rustcon.ru
Конференция по языку программирования Rust, Москва, 28 ноября 2025
#prog #c #article
Статья (от человека из комитета, если что) о том, почему в C всё так плохо и в обозримом будущем не поменяется.
Статья (от человека из комитета, если что) о том, почему в C всё так плохо и в обозримом будущем не поменяется.
The Pasture
Why the C Language Will Never Stop You from Making Mistakes
Short answer: because we said so.:)… What?Alright, fine, that’s too short to make it an article, dear reader, and my inflammatory words demand an explanation...
Forwarded from мне не нравится реальность
ДА ВЫ ШУТИТЕ
Мне кажется я ждал этого почти пару лет
take
* МЕТОДЫ У СЛАЙСА ОДОБРИЛИ С 4-Й ПОПЫТКИ ААААААААМне кажется я ждал этого почти пару лет
Блог*
#prog #article #soc В основе библиотек для PBT (property-based testing) лежит фреймворк для нахождения и минификации набора аргументов, на котором выполняется некоторый предикат. Этот фреймворк можно применять для совсем разных целей, например, для того,…
Telegram
☕️ Мерлин заваривает τσάι 🐌
Наткнулся на любопытную идею квадратичного голосования.
Суть в следующем: при прямой демократии работает эффект "тирании большинства". Суть эффекта примерно состоит в следующем: идёт голосование по безразличному для большинства, но важному для небольшой…
Суть в следующем: при прямой демократии работает эффект "тирании большинства". Суть эффекта примерно состоит в следующем: идёт голосование по безразличному для большинства, но важному для небольшой…
Идея о том, что человек может (и уж тем более должен) любить только кого-то одного — ограничена и вредна.
Forwarded from мне не нравится реальность
Тем временем вышел Rust 1.57 (анонс).
tl;dr несколько заинтересовавших меня штук:
—
— кастомные профили компиляции (как
—
—
tl;dr несколько заинтересовавших меня штук:
—
panic!
/todo!
/assert!
макросы в константных контекстах— кастомные профили компиляции (как
dev
, release
, test
и bench
, но произвольные)—
try_reserve
методы для коллекций (которые могут вернуть ошибку, если память выделить не получилось)—
Iterator::map_while
, смесь map
и take_while
(которую я добавил в стандартную библиотеку!)blog.rust-lang.org
Announcing Rust 1.57.0 | Rust Blog
Empowering everyone to build reliable and efficient software.
Forwarded from мне не нравится реальность
Ещё пара моментов, которые я упустил в предыдущем посте:
— Вопрос после вызовов макросов с
— Unicode 14.0
— Много функций пометили
—
Rust: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1570-2021-12-02
Cargo: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-157-2021-12-02
Clippy: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-157
— Вопрос после вызовов макросов с
{}
теперь валиден (можно писать m!{...}?
)— Unicode 14.0
— Много функций пометили
#[must_use]
— Vec::leak
теперь не реалоцирует (кто-нибудь знал что он так делал??)—
Ordering
теперь #[repr(i8)]
Ну и ссылки на полные чейнджлоги (ставьте лайк если тоже забыли про их существование):Rust: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1570-2021-12-02
Cargo: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-157-2021-12-02
Clippy: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-157
Блог*
Я, кстати, там докладчик, так что это ещё и шанс увидеться со мной вживую. Я бы сказал, какой доклад мой, но вы найдите сами, благо, зная меня, это не сложно.
Итого 50 слайдов.
50 слайдов. На 40 минут.
видимое беспокойство
50 слайдов. На 40 минут.
видимое беспокойство