11use bench_utils:: TextAction ;
2- use loro_internal:: { loro:: ExportMode , LoroDoc } ;
2+ use loro_internal:: { cursor :: PosType , loro:: ExportMode , LoroDoc } ;
33use std:: hint:: black_box;
44
55fn main ( ) {
@@ -17,8 +17,10 @@ fn log_size() {
1717 let mut txn = loro. txn ( ) . unwrap ( ) ;
1818
1919 for TextAction { pos, ins, del } in actions. iter ( ) {
20- text. delete_with_txn ( & mut txn, * pos, * del) ;
21- text. insert_with_txn ( & mut txn, * pos, ins) ;
20+ text. delete_with_txn ( & mut txn, * pos, * del, PosType :: Unicode )
21+ . unwrap ( ) ;
22+ text. insert_with_txn ( & mut txn, * pos, ins, PosType :: Unicode )
23+ . unwrap ( ) ;
2224 }
2325 txn. commit ( ) . unwrap ( ) ;
2426 let snapshot = loro. export ( ExportMode :: Snapshot ) . unwrap ( ) ;
@@ -46,8 +48,10 @@ fn log_size() {
4648
4749 for TextAction { pos, ins, del } in actions. iter ( ) {
4850 let mut txn = loro. txn ( ) . unwrap ( ) ;
49- text. delete_with_txn ( & mut txn, * pos, * del) ;
50- text. insert_with_txn ( & mut txn, * pos, ins) ;
51+ text. delete_with_txn ( & mut txn, * pos, * del, PosType :: Unicode )
52+ . unwrap ( ) ;
53+ text. insert_with_txn ( & mut txn, * pos, ins, PosType :: Unicode )
54+ . unwrap ( ) ;
5155 txn. commit ( ) . unwrap ( ) ;
5256 }
5357 let snapshot = loro. export ( ExportMode :: Snapshot ) . unwrap ( ) ;
@@ -71,8 +75,8 @@ fn bench_decode() {
7175
7276 for _ in 0 ..10 {
7377 for TextAction { pos, ins, del } in actions. iter ( ) {
74- text. delete ( * pos, * del) ;
75- text. insert ( * pos, ins) ;
78+ text. delete ( * pos, * del, PosType :: Unicode ) . unwrap ( ) ;
79+ text. insert ( * pos, ins, PosType :: Unicode ) . unwrap ( ) ;
7680 }
7781 }
7882 let snapshot = loro. export ( ExportMode :: Snapshot ) . unwrap ( ) ;
@@ -96,8 +100,10 @@ fn bench_decode_updates() {
96100 #[ allow( warnings) ]
97101 for TextAction { pos, ins, del } in actions. iter ( ) {
98102 let mut txn = loro. txn ( ) . unwrap ( ) ;
99- text. delete_with_txn ( & mut txn, * pos, * del) ;
100- text. insert_with_txn ( & mut txn, * pos, ins) ;
103+ text. delete_with_txn ( & mut txn, * pos, * del, PosType :: Unicode )
104+ . unwrap ( ) ;
105+ text. insert_with_txn ( & mut txn, * pos, ins, PosType :: Unicode )
106+ . unwrap ( ) ;
101107 txn. commit ( ) . unwrap ( ) ;
102108 }
103109
0 commit comments