Forwarded from Кіт ✙ без шляпи🇺🇦
> how to trim string in go
You do not cut strings in hurry, just stop and trim them
You do not cut strings in hurry, just stop and trim them
👍7❤1
> how to trim string in java
Just like in every other country, I guess. I mean, I didn't hear that cutting strings there is prohibited by law
Just like in every other country, I guess. I mean, I didn't hear that cutting strings there is prohibited by law
👍8❤1
> how to trim string in haskell
Firstly, they are called tendons, not strings. Secondly, leave messing with body to professional surgeons
Firstly, they are called tendons, not strings. Secondly, leave messing with body to professional surgeons
👍5❤1😁1
Forwarded from TechSparks
Гугл приготовил не очень приятный сюрприз для всяких быстро обученных аналитиков, которых выпускают курсы и буткемпы. Основное умение такого аналитика, как правило, состоит в том, что он(а) может покрутить данные в разных опенсорсных моделях и выявить, например, аномалии или сформулировать простейшие предсказания. Без минимальных навыков программирования это невозможно, и именно эти навыки и продаются.
Но вот Гугл начал интегрировать возможности своего TensorFlow прямо в Sheets, называется это очень адекватно SimpleML. Теперь имея таблицу данных, можно безо всякого программирования напустить на данные машинное обучение, и простейшие его результаты получить не покидая Sheets.
Everything runs completely on the user browser. Your data doesn’t leave Google Sheets and models are saved to your Google Drive so you can use them again later.
И, похоже, это только начало: наверняка и более сложные сценарии тоже в итоге в таблицы интегрируют. Очень впечатляющая и реально полезная реализация no code подхода. https://venturebeat.com/ai/google-brings-machine-learning-to-online-spreadsheets-with-simple-ml-for-sheets/
Но вот Гугл начал интегрировать возможности своего TensorFlow прямо в Sheets, называется это очень адекватно SimpleML. Теперь имея таблицу данных, можно безо всякого программирования напустить на данные машинное обучение, и простейшие его результаты получить не покидая Sheets.
Everything runs completely on the user browser. Your data doesn’t leave Google Sheets and models are saved to your Google Drive so you can use them again later.
И, похоже, это только начало: наверняка и более сложные сценарии тоже в итоге в таблицы интегрируют. Очень впечатляющая и реально полезная реализация no code подхода. https://venturebeat.com/ai/google-brings-machine-learning-to-online-spreadsheets-with-simple-ml-for-sheets/
VentureBeat
Google brings machine learning to online spreadsheets with Simple ML for Sheets
Today Google announced a beta release of Simple ML for Sheets, which allows users without ML experience to try ML out on their spreadsheets.
#prog #rust
Посмотрим вот на этот код:
Отличаются эти две функции, помимо названия, лишь порядком лайфтаймов в определении. Тем не менее, проверка показывает, что вторая функция компилируется, а первая — нет.
Это — баг компилятора. К счастью, фикс есть, надеюсь, скоро смержат.
Посмотрим вот на этот код:
async fn fail<'a, 'b, 'c>(_: &'static str)
where
'a: 'c, 'b: 'c,
{}
async fn pass<'a, 'c, 'b>(_: &'static str)
where
'a: 'c, 'b: 'c,
{}
Отличаются эти две функции, помимо названия, лишь порядком лайфтаймов в определении. Тем не менее, проверка показывает, что вторая функция компилируется, а первая — нет.
Это — баг компилятора. К счастью, фикс есть, надеюсь, скоро смержат.
play.rust-lang.org
Rust Playground
A browser interface to the Rust compiler to experiment with the language
👍8🤔3🔥1🤯1
#prog #rust #article
Self-referential types for fun and profit
<...>Contrary to usual answers, this will show how to create self-referential types manually. A very important subset of such types are straightforward to reason about and, most importantly, can be manipulated through a safe interface. We will not rewrite the borrow checker, we will not use
Self-referential types for fun and profit
<...>Contrary to usual answers, this will show how to create self-referential types manually. A very important subset of such types are straightforward to reason about and, most importantly, can be manipulated through a safe interface. We will not rewrite the borrow checker, we will not use
std::pin, but we will use a bit of unsafe. You’ve been warned.More Stina Blog!
Self-referential types for fun and profit
Some Rust questions are asked over and over, and are therefore met with short and well-rehearsed answers. “Compile in release mode when measuring performance.” “Don’t try to…
❤1
#prog #parsing #rust #article
Parsing numbers into base-10 decimals with SIMD
When parsing number-dense JSON, much of the overhead is parsing numbers instead of parsing the JSON itself. For the typical case, most of the overhead within number parsing is converting into a form mantissa * 10^-exponent, not transforming into a proper floating point value.
Looking through high-quality number parsers such as rust_decimal’s or simd_json’s, they tend to avoid SIMD or only use it after ensuring there’s a long enough series of decimal characters. They also don’t support parsing in batches and concern themselves with problems like
* How do I avoid reading off the end of the number?
* How can I give precise error messages?
* How do I handle extremely long decimals?
* How do I handle separators?
In realistic parses, most of the above never apply! Invalid data is rare, long numbers are rare, weird separators are rare, and most numbers aren’t at the end of a buffer (with padding, none are). We can relax the above constraints and get something friendlier to a SIMD implementation. First, we assume:
1. All inputs have an extra 16 bytes of data off the end
2. Precise error reporting is not required
3. Inputs are not longer than 16 bytes
4. Inputs only contain digits and potentially 1 ‘.’
5. The sign is already processed (it’s just a simple check and pointer adjustment)
6. Optionally, we can parse many numbers at once
While these restrictions appear limiting, they’ll handle almost all actual cases, and a fallback can take the rest. With these considerations, we can go about writing a vectorized parser.
<...>
The elephant in the room is figuring out if this optimized parser is faster in real-world settings. It’s one thing to be faster in a very tight microbenchmark loop; replicating performance improvements in production is more challenging. Microbenchmarks can exacerbate coincidental interactions with microarchitecture that wouldn’t be relevant in the real world. Especially in parsing, there’s lots of complex, branchy, unpredictable surrounding code that complicates an otherwise clean sequence of instructions.
I’m experimenting with adding this to the rust port of simd-json, and adding unsafe fast-path parsers to rust_decimal. Hopefully we’ll see the desired real-world gains!
Parsing numbers into base-10 decimals with SIMD
When parsing number-dense JSON, much of the overhead is parsing numbers instead of parsing the JSON itself. For the typical case, most of the overhead within number parsing is converting into a form mantissa * 10^-exponent, not transforming into a proper floating point value.
Looking through high-quality number parsers such as rust_decimal’s or simd_json’s, they tend to avoid SIMD or only use it after ensuring there’s a long enough series of decimal characters. They also don’t support parsing in batches and concern themselves with problems like
* How do I avoid reading off the end of the number?
* How can I give precise error messages?
* How do I handle extremely long decimals?
* How do I handle separators?
In realistic parses, most of the above never apply! Invalid data is rare, long numbers are rare, weird separators are rare, and most numbers aren’t at the end of a buffer (with padding, none are). We can relax the above constraints and get something friendlier to a SIMD implementation. First, we assume:
1. All inputs have an extra 16 bytes of data off the end
2. Precise error reporting is not required
3. Inputs are not longer than 16 bytes
4. Inputs only contain digits and potentially 1 ‘.’
5. The sign is already processed (it’s just a simple check and pointer adjustment)
6. Optionally, we can parse many numbers at once
While these restrictions appear limiting, they’ll handle almost all actual cases, and a fallback can take the rest. With these considerations, we can go about writing a vectorized parser.
<...>
The elephant in the room is figuring out if this optimized parser is faster in real-world settings. It’s one thing to be faster in a very tight microbenchmark loop; replicating performance improvements in production is more challenging. Microbenchmarks can exacerbate coincidental interactions with microarchitecture that wouldn’t be relevant in the real world. Especially in parsing, there’s lots of complex, branchy, unpredictable surrounding code that complicates an otherwise clean sequence of instructions.
I’m experimenting with adding this to the rust port of simd-json, and adding unsafe fast-path parsers to rust_decimal. Hopefully we’ll see the desired real-world gains!
vgatherps.github.io
Parsing numbers into base-10 decimals with SIMD
Using SIMD to accelerate decimal parsing
🔥1
Блог*
#prog #parsing #rust #article Parsing numbers into base-10 decimals with SIMD When parsing number-dense JSON, much of the overhead is parsing numbers instead of parsing the JSON itself. For the typical case, most of the overhead within number parsing is…
Но на микробенчмарках результаты хорошие
Блог*
#prog #parsing #rust #article Parsing numbers into base-10 decimals with SIMD When parsing number-dense JSON, much of the overhead is parsing numbers instead of parsing the JSON itself. For the typical case, most of the overhead within number parsing is…
vgatherps.github.io
Parsing numbers with SIMD 2 - trying NEON
Finding an excuse to learn NEON
👍1
Forwarded from dev optozorax
Онигири придумал и сделал волновую симуляцию света на основе клеточных автоматов. В итоге получаются очень красивые и графонистые картинки распространения света. Настолько простых и качественных симуляций света я раньше не видел.
https://www.youtube.com/watch?v=noUpBKY2rIg
Там же там есть связанное видео про радугу от Макара Светлого, тоже рекомендую заценить.
А ещё он опубликовал код, который прямо в браузере рисует это на шейдерах через видеокарту, можете зайти с компа или телефона: onigiriScience/71.
https://www.youtube.com/watch?v=noUpBKY2rIg
Там же там есть связанное видео про радугу от Макара Светлого, тоже рекомендую заценить.
А ещё он опубликовал код, который прямо в браузере рисует это на шейдерах через видеокарту, можете зайти с компа или телефона: onigiriScience/71.
YouTube
Сделал СИМУЛЯЦИЮ ВОЛН СВЕТА на КЛЕТОЧНЫХ АВТОМАТАХ
Арендуйте облачный или выделенный сервер с GPU в Selectel для рендеринга, работы с графикой и 3D-моделирования: https://slc.tl/jc1uc
Видео с Макаром Светлым: https://www.youtube.com/watch?v=LmrhMaR8xVk
Видео про клеточные автоматы: https://www.youtube.c…
Видео с Макаром Светлым: https://www.youtube.com/watch?v=LmrhMaR8xVk
Видео про клеточные автоматы: https://www.youtube.c…
❤2❤🔥1
Forwarded from Код, коты и карандаш
— Почему из хаскелистов получаются хорошие супруги?
— Они не умеют изменять.
— Они не умеют изменять.
🔥25😁9
#prog
Данила рассказывает про техники оптимизации для сокращения размера lookup-таблиц, часто применяемые для оптимизации регулярных выражений.
t.iss.one/experimentalchill/205
Данила рассказывает про техники оптимизации для сокращения размера lookup-таблиц, часто применяемые для оптимизации регулярных выражений.
t.iss.one/experimentalchill/205
Telegram
Experimental chill
Одна из оптимизаций в регулярных выражениях, поисках по строкам и подобных state transition алгоритмов заключается в достаточно хитрой оптимизации инструкций.
Пусть у вас есть какой-то граф, по которому надо ходить в зависимости от одного из 255 символов:…
Пусть у вас есть какой-то граф, по которому надо ходить в зависимости от одного из 255 символов:…
#rust #video
The Death and Rebirth of Docs.rs
Fun fact: ввиду особых потребностей docs.rs пришлось в какой-то момент использовать кастомный форк rustdoc — и так как это, по сути, часть компилятора, фактически кастомный форк компилятора — и за промежуток больше года, в течение которого использовался этот форк, изменения подтягивались из апстрима всего семь раз (включая финальный, когда нужные изменения приняли в апстрим и содержать кастомный форк более не было необходимости)
The Death and Rebirth of Docs.rs
Fun fact: ввиду особых потребностей docs.rs пришлось в какой-то момент использовать кастомный форк rustdoc — и так как это, по сути, часть компилятора, фактически кастомный форк компилятора — и за промежуток больше года, в течение которого использовался этот форк, изменения подтягивались из апстрима всего семь раз (включая финальный, когда нужные изменения приняли в апстрим и содержать кастомный форк более не было необходимости)
YouTube
The Death and Rebirth of Docs.rs - Quiet Misdreavus
Docs.rs is a beloved resource in the Rust community, but it was not long ago that such a resource did not exist. Join QuietMisdreavus as she tells the story of docs.rs, from its humble beginnings as crates.fyi and a Rustacean's learning project; through to…
🤔1