This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch update_benchmakr in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 18f19acb2e306b09f3438f1fb6c9c260e14128c4 Author: chaokunyang <[email protected]> AuthorDate: Tue Oct 28 01:05:08 2025 +0800 add rust benchamrk and code example for rust and python --- public/benchmarks/rust/company.png | Bin 0 -> 44643 bytes public/benchmarks/rust/ecommerce_data.png | Bin 0 -> 44956 bytes public/benchmarks/rust/person.png | Bin 0 -> 40224 bytes public/benchmarks/rust/simple_list.png | Bin 0 -> 39423 bytes public/benchmarks/rust/simple_map.png | Bin 0 -> 45555 bytes public/benchmarks/rust/simple_struct.png | Bin 0 -> 43007 bytes public/benchmarks/rust/system_data.png | Bin 0 -> 41417 bytes src/constants/index.ts | 47 ++++++++++++++++++++++++++++++ 8 files changed, 47 insertions(+) diff --git a/public/benchmarks/rust/company.png b/public/benchmarks/rust/company.png new file mode 100644 index 000000000..eee9de23f Binary files /dev/null and b/public/benchmarks/rust/company.png differ diff --git a/public/benchmarks/rust/ecommerce_data.png b/public/benchmarks/rust/ecommerce_data.png new file mode 100644 index 000000000..11a507329 Binary files /dev/null and b/public/benchmarks/rust/ecommerce_data.png differ diff --git a/public/benchmarks/rust/person.png b/public/benchmarks/rust/person.png new file mode 100644 index 000000000..d31e0d030 Binary files /dev/null and b/public/benchmarks/rust/person.png differ diff --git a/public/benchmarks/rust/simple_list.png b/public/benchmarks/rust/simple_list.png new file mode 100644 index 000000000..00c5b7d4e Binary files /dev/null and b/public/benchmarks/rust/simple_list.png differ diff --git a/public/benchmarks/rust/simple_map.png b/public/benchmarks/rust/simple_map.png new file mode 100644 index 000000000..1142bb3fb Binary files /dev/null and b/public/benchmarks/rust/simple_map.png differ diff --git a/public/benchmarks/rust/simple_struct.png b/public/benchmarks/rust/simple_struct.png new file mode 100644 index 000000000..973fa35e8 Binary files /dev/null and b/public/benchmarks/rust/simple_struct.png differ diff --git a/public/benchmarks/rust/system_data.png b/public/benchmarks/rust/system_data.png new file mode 100644 index 000000000..330aa6b52 Binary files /dev/null and b/public/benchmarks/rust/system_data.png differ diff --git a/src/constants/index.ts b/src/constants/index.ts index 77b20b3bc..4c8ee93d4 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -76,6 +76,53 @@ object ScalaExample { }`, }, + rust: { + label: "Rust", + code: `use fory::{Fory, Error}; +use fory::ForyObject; + +#[derive(ForyObject, Debug, PartialEq)] +struct User { + name: String, + age: i32, + email: String, +} + +fn main() -> Result<(), Error> { + let mut fory = Fory::default(); + fory.register::<User>(1)?; + + let user = User { name: "Alice".into(), age: 30, email: "[email protected]".into() }; + let bytes = fory.serialize(&user)?; + let decoded: User = fory.deserialize(&bytes)?; + assert_eq!(user, decoded); + Ok(()) +}`, + + }, + + python: { + label: "Python", + code: `import pyfory +from dataclasses import dataclass +from typing import List, Dict + +@dataclass +class Person: + name: str + age: int + scores: List[int] + metadata: Dict[str, str] + +# Python mode - supports all Python types including dataclasses +fory = pyfory.Fory(xlang=False, ref=True) +fory.register(Person) +person = Person("Bob", 25, [88, 92, 85], {"team": "engineering"}) +data = fory.serialize(person) +result = fory.deserialize(data) +print(result) # Person(name='Bob', age=25, ...)`, + }, + }; export const imageUrls = [ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
