Skip to content

Commit

Permalink
disable unroll
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Apr 9, 2024
1 parent c6948ee commit bd21743
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rust/candid/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ 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);
/*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
5 changes: 3 additions & 2 deletions rust/candid/tests/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ fn test_struct() {
);

let list: Option<List> = None;
// without memoization on the unrolled type, type table will have 3 entries.
all_check(list, "4449444c026e016c02a0d2aca8047c90eddae70400010000");
// with memoization on the unrolled type, type table will have 2 entries.
// all_check(list, "4449444c026e016c02a0d2aca8047c90eddae70400010000");
all_check(list, "4449444c036e016c02a0d2aca8047c90eddae704026e01010000");
}

#[test]
Expand Down

0 comments on commit bd21743

Please sign in to comment.