#prog #rust #article #successstory
Parsing logs 230x faster with Rust
As fantastic gravy on top of this whole situation, after a few days I realized that I needed to know exactly how much it would cost. With each log file taking about 23 seconds, and there being about 500 log files per day, it seemed like I would need about 350,000 seconds of Lambda execution time per month.
Then, when I went to look up Lambda pricing, I noticed that it has a free tier: 400,000 seconds per month. So in the end, it seems like I’m parsing 500GB of logs per day… for free. 😆
Parsing logs 230x faster with Rust
As fantastic gravy on top of this whole situation, after a few days I realized that I needed to know exactly how much it would cost. With each log file taking about 23 seconds, and there being about 500 log files per day, it seemed like I would need about 350,000 seconds of Lambda execution time per month.
Then, when I went to look up Lambda pricing, I noticed that it has a free tier: 400,000 seconds per month. So in the end, it seems like I’m parsing 500GB of logs per day… for free. 😆
Cloud City Development
Parsing logs 230x faster with Rust
Perhaps surprisingly, one of the most challenging things about operating RubyGems.org is the logs. Unlike most Rails applications, RubyGems sees between 4,000 and 25,000 requests per second, all day long, every single day. As you can probably imagine, this…
Forwarded from Санечка Ъысь (Anna Weiss)
This media is not supported in your browser
VIEW IN TELEGRAM
👍9🔥5
#prog #js #typescript #abnormalprogramming
github.com/jamiebuilds/json-parser-in-typescript-very-bad-idea-please-dont-use
github.com/jamiebuilds/json-parser-in-typescript-very-bad-idea-please-dont-use
GitHub
GitHub - jamiebuilds/json-parser-in-typescript-very-bad-idea-please-dont-use: JSON Parser written entirely in TypeScript's type…
JSON Parser written entirely in TypeScript's type system - jamiebuilds/json-parser-in-typescript-very-bad-idea-please-dont-use
Forwarded from Антон
Это индустриальный стандарт. То есть нечто настолько плохое, что те, кто поддались на обманчивую простоту, обиделись достаточно сильно, чтобы заставить также страдать и своих коллег
👍5🔥2👎1😢1
Блог*
#prog #rust #cpp #java #article A Rust Gem: The Rust Map API
Вдобавок ко всему тому, что написано в статье, хочу отметить, что Entry API позволяет просто делать то, что в других языках выглядит зачастую весьма неловко: получить значение по ключу и в случае его отсутствия вставить новое значение, сконструированное при помощи функции, которая может завершиться ошибкой.
Пример:
Пример:
fn get_file_contents(
name: PathBuf,
contents: &mut HashMap<PathBuf, String>,
) -> std::io::Result<&str> {
use std::collections::hash_map::Entry;
Ok(match contents.entry(name) {
Entry::Occupied(e) => e.into_mut(),
Entry::Vacant(e) => {
let file_contents = std::fs::read_to_string(e.key())?;
e.insert(file_contents)
}
})
}
Известные мне альтернативы в других языках позволяют сигнализировать об ошибке в подобных ситуациях лишь при помощи исключений👍2
Using Go is a no-brainer in the sense that one has to have no brain in order to even consider using it
👎20👍11😁7👏1💩1
#prog #parsing #article
Obliteratingly Fast Parser Combinators (pdf)
Lexers and parsers are typically defined separately and connected by a token stream. This separate definition is important for modularity, but harmful for performance.
We show how to fuse together separately-defined lexers and parsers, drastically improving performance without compromising modularity. Our staged parser combinator library, flap, provides a standard parser combinator interface, but generates psecialized token-free code that runs several times faster than ocamlyacc on a range of benchmarks.
(thanks @clayrat)
Obliteratingly Fast Parser Combinators (pdf)
Lexers and parsers are typically defined separately and connected by a token stream. This separate definition is important for modularity, but harmful for performance.
We show how to fuse together separately-defined lexers and parsers, drastically improving performance without compromising modularity. Our staged parser combinator library, flap, provides a standard parser combinator interface, but generates psecialized token-free code that runs several times faster than ocamlyacc on a range of benchmarks.
(thanks @clayrat)
Blogspot
Obliteratingly Fast Parser Combinators
Jeremy Yallop , Ningning Xie , and I have a new draft out about combinator parsing, entitled Fusing Lexing and Parsing . The abstract is sh...
🔥6
Блог*
Сделать, что ли, отдельный хештег для serde 🤔
Таки сделал. А ещё сделал отдельный хештег parsing, а то материалов по парсингу на канале уже довольно много
Блог*
#моё #prog #rust В крейте time есть структура Date с методом format, который возвращает String со датой, отформатированной согласно переданному формату. Выглядит это примерно так (пример из документации): assert_eq!(date!(2019-01-02).format("%Y-%m-%d"),…
#prog #rust #rustlib
Хочу отметить, что моя претензия — парсинг форматной строки снова и снова — была решена в time начиная с версии 0.3.0, выпущенной 30 июля 2021 года, причём с подходом, похожим на описанный ранее мною в блоге.
Что там добавилось? Отдельный модуль format_description, который определяет пачку типов, описывающих компоненты формата — включая FormatItem и Component — и модуль formatting с трейтом Formattable, который реализовывается типами, описывающими формат форматирования даты и времени. Для того, чтобы получить формат из строки, достаточно вызвать функцию format_description::parse — или, если вы не хотите разбираться с ошибками при парсинге, макрос macros::format_description, который разберёт формат на этапе компиляции и проверит его правильность — и затем использовать результат в методах {Date, OffsetDateTime, PrimitiveDateTime, Time}::format, принимающих вторым аргументом ссылку на значение типа, реализующее
Хочу отметить, что моя претензия — парсинг форматной строки снова и снова — была решена в time начиная с версии 0.3.0, выпущенной 30 июля 2021 года, причём с подходом, похожим на описанный ранее мною в блоге.
Что там добавилось? Отдельный модуль format_description, который определяет пачку типов, описывающих компоненты формата — включая FormatItem и Component — и модуль formatting с трейтом Formattable, который реализовывается типами, описывающими формат форматирования даты и времени. Для того, чтобы получить формат из строки, достаточно вызвать функцию format_description::parse — или, если вы не хотите разбираться с ошибками при парсинге, макрос macros::format_description, который разберёт формат на этапе компиляции и проверит его правильность — и затем использовать результат в методах {Date, OffsetDateTime, PrimitiveDateTime, Time}::format, принимающих вторым аргументом ссылку на значение типа, реализующее
Formattable
.docs.rs
time - Rust
Feature flags
#prog #python #article
Jupyter Ascending: A Retrograde Development
Computational notebooks have a history dating back to the late 1980s, <...>. They combine two much older, better, but less popular ideas into a synthesis which manages to be less than the sum of its parts.
(и вдогонку ссылка оттуда на презентацию доклада I Don't Like Notebooks от Joel Grus, сделанного для JupyterCon 2018)
Jupyter Ascending: A Retrograde Development
Computational notebooks have a history dating back to the late 1980s, <...>. They combine two much older, better, but less popular ideas into a synthesis which manages to be less than the sum of its parts.
(и вдогонку ссылка оттуда на презентацию доклада I Don't Like Notebooks от Joel Grus, сделанного для JupyterCon 2018)
Google Docs
I Don't Like Notebooks - Joel Grus - #JupyterCon 2018
I Don't Like Notebooks hi, I'm Joel, and I don't like notebooks Joel Grus (@joelgrus) #JupyterCon 2018
👍2❤1