From e04ea735b087742b6cee738aa295d8b835c3a195 Mon Sep 17 00:00:00 2001 From: ijl Date: Fri, 23 Feb 2024 00:07:53 +0000 Subject: [PATCH] cargo update, build misc --- Cargo.lock | 35 +++++++++++++++------------------ Cargo.toml | 2 +- script/develop | 11 +++++++---- script/graph | 7 +++++-- src/deserialize/cache.rs | 3 +-- src/deserialize/error.rs | 3 ++- src/serialize/per_type/numpy.rs | 1 - 7 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8a171da..9ffb4045 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" dependencies = [ "cfg-if", "const-random", @@ -62,12 +62,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" [[package]] name = "cfg-if" @@ -274,27 +271,27 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" dependencies = [ "no-panic", ] [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -303,9 +300,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -332,9 +329,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -343,9 +340,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tiny-keccak" diff --git a/Cargo.toml b/Cargo.toml index 5f675fc9..d9626d02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ no-panic = [ yyjson = [] [dependencies] -ahash = { version = "^0.8.8", default_features = false, features = ["compile-time-rng"] } +ahash = { version = "^0.8.9", default_features = false, features = ["compile-time-rng"] } arrayvec = { version = "0.7", default_features = false, features = ["std", "serde"] } associative-cache = { version = "2", default_features = false } beef = { version = "0.5", default_features = false, features = ["impl_serde"] } diff --git a/script/develop b/script/develop index 50568f63..33036719 100755 --- a/script/develop +++ b/script/develop @@ -2,10 +2,13 @@ rm -f target/wheels/* -export CC="clang" -export CFLAGS="-O2 -fstrict-aliasing -emit-llvm -flto=full" -export LDFLAGS="${CFLAGS} -fuse-ld=lld -Wl,--as-needed -Wl,-plugin-opt=also-emit-llvm" -export RUSTFLAGS="-C linker=clang -C linker-plugin-lto -C lto=fat -C link-arg=-fuse-ld=lld -Z mir-opt-level=4 -Z virtual-function-elimination" +export CC="${CC:-clang}" +export LD="${LD:-lld}" + +echo "CC: ${CC}, LD: ${LD}, LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}" +export CFLAGS="-Os -fstrict-aliasing -emit-llvm -flto=full" +export LDFLAGS="${CFLAGS} -fuse-ld=${LD} -Wl,--as-needed -Wl,-plugin-opt=also-emit-llvm" +export RUSTFLAGS="-C linker=${CC} -C linker-plugin-lto -C lto=fat -C link-arg=-fuse-ld=${LD} -Z mir-opt-level=4 -Z virtual-function-elimination" maturin build "$@" diff --git a/script/graph b/script/graph index 401652e0..afd45ce9 100755 --- a/script/graph +++ b/script/graph @@ -89,6 +89,8 @@ def tab(obj): if not per_op_data: continue + clamp = 10 if operation == "serialization" else 5 + json_baseline = {} for each in per_op_data: if each["group"] == "witter.json": @@ -97,7 +99,9 @@ def tab(obj): json_baseline[each["group"]] = each["operations"] for each in per_op_data: - each["relative"] = each["operations"] / json_baseline[each["group"]] + each["relative"] = min( + each["operations"] / json_baseline[each["group"]], clamp + ) p = pd.DataFrame.from_dict(per_op_data) p.groupby("group") @@ -117,7 +121,6 @@ def tab(obj): pyplot.title(operation) # ensure Y range - clamp = 10 if operation == "serialization" else 5 ylabels = set((min(v, clamp) for v in pyplot.gca().get_yticks())) pyplot.gca().set_yticks(list({1.0, 1.5}.union(ylabels))) diff --git a/src/deserialize/cache.rs b/src/deserialize/cache.rs index fdd75511..169712ad 100644 --- a/src/deserialize/cache.rs +++ b/src/deserialize/cache.rs @@ -1,7 +1,6 @@ // SPDX-License-Identifier: (Apache-2.0 OR MIT) -use associative_cache::replacement::RoundRobinReplacement; -use associative_cache::*; +use associative_cache::{AssociativeCache, Capacity1024, HashDirectMapped, RoundRobinReplacement}; use core::ffi::c_void; use once_cell::unsync::OnceCell; use std::hash::Hasher; diff --git a/src/deserialize/error.rs b/src/deserialize/error.rs index 92dc89e1..00e9dd02 100644 --- a/src/deserialize/error.rs +++ b/src/deserialize/error.rs @@ -51,9 +51,10 @@ impl<'a> DeserializeError<'a> { /// Return position of the error in the deserialized data #[cold] #[cfg(feature = "yyjson")] + #[cfg_attr(feature = "optimize", optimize(size))] pub fn pos(&self) -> i64 { match self.data { - Some(as_str) => bytecount::num_chars(&as_str.as_bytes()[0..self.pos as usize]) as i64, + Some(as_str) => as_str[0..self.pos as usize].chars().count() as i64, None => 0, } } diff --git a/src/serialize/per_type/numpy.rs b/src/serialize/per_type/numpy.rs index ee6bb599..d6515f98 100644 --- a/src/serialize/per_type/numpy.rs +++ b/src/serialize/per_type/numpy.rs @@ -10,7 +10,6 @@ use chrono::{Datelike, NaiveDate, NaiveDateTime, Timelike}; use core::ffi::{c_char, c_int, c_void}; use pyo3_ffi::*; use serde::ser::{self, Serialize, SerializeSeq, Serializer}; -use std::convert::TryInto; use std::fmt; #[repr(transparent)]