From e7c1985c1b6c725f35a214f29aa7586a751f100b Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 3 Jun 2024 10:14:46 +0800 Subject: [PATCH] Update benchmark results --- DEVELOPMENT.md | 5 +++++ README.md | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 70b88fa..2b216f3 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -5,3 +5,8 @@ When we want test `cargo i18n` in local dev, we can: ```bash $ cargo run -- i18n ~/work/some-rust-project ``` + +## How to release + +1. Update `Cargo.toml` version +2. Run `make release` to build and publish to crates.io diff --git a/README.md b/README.md index 3c1ea25..5184fbb 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,9 @@ You can also split the each language into difference files, and you can choise ( ```yml _version: 1 -hello: 'Hello world' -messages.hello: 'Hello, %{name}' -t_4Cct6Q289b12SkvF47dXIx: 'Hello, %{name}' +hello: "Hello world" +messages.hello: "Hello, %{name}" +t_4Cct6Q289b12SkvF47dXIx: "Hello, %{name}" ``` Or use JSON or TOML format, just rename the file to `en.json` or `en.toml`, and the content is like this: @@ -421,18 +421,19 @@ $ RUST_I18N_DEBUG=1 cargo build ## Benchmark -Benchmark [`t!`] method, result on Apple M1: +Benchmark [`t!`] method, result on MacBook Pro (2023, Apple M3): ```bash -t time: [58.274 ns 60.222 ns 62.390 ns] -t_with_locale time: [55.395 ns 57.106 ns 59.081 ns] -t_with_args time: [167.46 ns 170.94 ns 175.64 ns] -t_with_args (str) time: [164.85 ns 165.91 ns 167.41 ns] -t_with_args (many) time: [444.04 ns 452.17 ns 463.44 ns] -t_with_threads time: [414.26 ns 422.97 ns 433.53 ns] +t time: [32.637 ns 33.139 ns 33.613 ns] +t_with_locale time: [24.616 ns 24.812 ns 25.071 ns] +t_with_args time: [128.70 ns 128.97 ns 129.24 ns] +t_with_args (str) time: [129.48 ns 130.08 ns 130.76 ns] +t_with_args (many) time: [370.28 ns 374.46 ns 380.56 ns] +t_with_threads time: [38.619 ns 39.506 ns 40.419 ns] +t_lorem_ipsum time: [33.867 ns 34.286 ns 34.751 ns] ``` -The result `101 ns (0.0001 ms)` means if there have 10K translate texts, it will cost 1ms. +The result `101 ns (0.0001 ms)` means if there have **10K** translate texts, it will cost `1ms`. ## License