Skip to content

Commit

Permalink
bump and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Apr 11, 2024
1 parent bd21743 commit d53d4b5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@

# Changelog

## 2024-04-11

### Candid 0.10.7 -- 0.10.5

* Switch `HashMap` to `BTreeMap` in serialization and `T::ty()`. This leads to around 20% perf improvement for serializing complicated types.
* Disable memoization for unrolled types in serialization to save cycle cost. In some cases, type table can get slightly larger, but it's worth the trade off.
* Fix bug in `text_size`
* Fix decoding cost calculation overflow

## 2024-02-27

### Candid 0.10.4
Expand Down
2 changes: 1 addition & 1 deletion rust/candid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "candid"
version = "0.10.6"
version = "0.10.7"
edition = "2021"
rust-version.workspace = true
authors = ["DFINITY Team"]
Expand Down
13 changes: 7 additions & 6 deletions rust/candid/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,13 @@ impl TypeSerialize {
// from the type table.
// Someone should implement Pottier's O(nlogn) algorithm
// http://gallium.inria.fr/~fpottier/publis/gauthier-fpottier-icfp04.pdf
/*let unrolled = types::internal::unroll(t);
if let Some(idx) = self.type_map.get(&unrolled) {
let idx = *idx;
self.type_map.insert(t.clone(), idx);
return Ok(());
}*/
// Disable this "optimization", as unroll is expensive and has to be called on every recursion.
// let unrolled = types::internal::unroll(t);
// if let Some(idx) = self.type_map.get(&unrolled) {
// let idx = *idx;
// self.type_map.insert(t.clone(), idx);
// return Ok(());
// }

let idx = self.type_table.len();
self.type_map.insert(t.clone(), idx as i32);
Expand Down
2 changes: 1 addition & 1 deletion rust/candid/src/types/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::fmt;
// This is a re-implementation of std::any::TypeId to get rid of 'static constraint.
// The current TypeId doesn't consider lifetime while computing the hash, which is
// totally fine for Candid type, as we don't care about lifetime at all.
#[derive(Debug, PartialEq, Eq, Hash, Clone, Ord, PartialOrd)]
#[derive(Debug, PartialEq, Eq, Hash, Clone, PartialOrd, Ord)]
pub struct TypeId {
id: usize,
pub name: &'static str,
Expand Down

0 comments on commit d53d4b5

Please sign in to comment.