add comments about sume parts that are verified to work as far as line breaks go

This commit is contained in:
2024-07-02 06:02:16 +01:00
parent 3e924b1082
commit 65b3db2a6a
4 changed files with 11 additions and 17 deletions

View File

@@ -7,6 +7,9 @@ bench: gap_buffer_svelte gap_buffer_rust gap_buffer_seph gap_buffer_automerge ro
gap_buffer_svelte: gap_buffer_svelte:
mlton gap_buffer_svelte.mlb mlton gap_buffer_svelte.mlb
gap_buffer_svelte_llvm:
mlton -output gap_buffer_svelte_llvm -codegen llvm gap_buffer_svelte.mlb
gap_buffer_rust: gap_buffer_rust:
mlton gap_buffer_rust.mlb mlton gap_buffer_rust.mlb
@@ -16,6 +19,9 @@ gap_buffer_seph:
gap_buffer_automerge: gap_buffer_automerge:
mlton gap_buffer_automerge.mlb mlton gap_buffer_automerge.mlb
gap_buffer_automerge_llvm:
mlton -output gap_buffer_automerge_llvm -codegen llvm gap_buffer_automerge.mlb
rope_svelte: rope_svelte:
mlton rope_svelte.mlb mlton rope_svelte.mlb

BIN
bench/gap_buffer_automerge_llvm Executable file

Binary file not shown.

BIN
bench/gap_buffer_svelte_llvm Executable file

Binary file not shown.

View File

@@ -685,21 +685,10 @@ struct
if isInLimit (newString, rightStringsHd, newLines, rightLinesHd) then if isInLimit (newString, rightStringsHd, newLines, rightLinesHd) then
(* Allocate new string because we can do so while staying in limit. *) (* Allocate new string because we can do so while staying in limit. *)
let let
(* VERIFIED TO WORK *)
val _ = print "line 474\n" val _ = print "line 474\n"
val newRightStringsHd = rightStringsHd ^ newString val newRightStringsHd = rightStringsHd ^ newString
val newRightLinesHd = countLineBreaks newRightStringsHd val newRightLinesHd = countLineBreaks newRightStringsHd
(*
val newRightLinesHd =
Vector.tabulate
( Vector.length newLines + Vector.length rightLinesHd
, fn idx =>
if idx < Vector.length rightLinesHd then
Vector.sub (rightLinesHd, idx)
else
Vector.sub (newLines, idx - Vector.length rightLinesHd)
+ String.size rightStringsHd
)
*)
in in
verifyReturn verifyReturn
{ idx = curIdx { idx = curIdx
@@ -707,7 +696,7 @@ struct
, leftStrings = leftStrings , leftStrings = leftStrings
, leftLines = leftLines , leftLines = leftLines
, rightStrings = newRightStringsHd :: rightStringsTl , rightStrings = newRightStringsHd :: rightStringsTl
, rightLines = countLineBreaks newRightStringsHd :: rightLinesTl , rightLines = newRightLinesHd :: rightLinesTl
} }
end end
else else
@@ -918,13 +907,13 @@ struct
isInLimit isInLimit
(leftStringsHd, rightStringsHd, leftLinesHd, rightLinesHd) (leftStringsHd, rightStringsHd, leftLinesHd, rightLinesHd)
*) *)
false true
then then
let let
(* VERIFIED TO WORK *)
val _ = print "line 650\n" val _ = print "line 650\n"
val nextLine = curLine + Vector.length rightLinesHd val nextLine = curLine + Vector.length rightLinesHd
val newLeftStringsHd = leftStringsHd ^ rightStringsHd val newLeftStringsHd = leftStringsHd ^ rightStringsHd
(*
val newLeftLinesHd = val newLeftLinesHd =
Vector.tabulate Vector.tabulate
( Vector.length leftLinesHd ( Vector.length leftLinesHd
@@ -936,8 +925,7 @@ struct
Vector.sub Vector.sub
(rightLinesHd, idx - Vector.length leftLinesHd) (rightLinesHd, idx - Vector.length leftLinesHd)
+ String.size leftStringsHd + String.size leftStringsHd
) *) )
val newLeftLinesHd = countLineBreaks newLeftStringsHd
in in
moveRightAndIns moveRightAndIns
( idx ( idx