Add 'brolib-sml/' from commit 'fd96032949434207dda3b288f48d7fe579f59e4e'
git-subtree-dir: brolib-sml git-subtree-mainline:64471ecf7fgit-subtree-split:fd96032949
This commit is contained in:
47
brolib-sml/bench/Makefile
Normal file
47
brolib-sml/bench/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
bench: gap_buffer_svelte gap_buffer_rust gap_buffer_seph gap_buffer_automerge line_gap_svelte line_gap_rust line_gap_seph line_gap_automerge rope_svelte rope_rust rope_seph rope_automerge
|
||||
hyperfine './gap_buffer_svelte' './rope_svelte' './line_gap_svelte' --export-markdown svelte.md
|
||||
hyperfine './gap_buffer_rust' './rope_rust' './line_gap_rust' --export-markdown rust.md
|
||||
hyperfine './gap_buffer_seph' './rope_seph' './line_gap_seph' --export-markdown seph.md
|
||||
hyperfine './gap_buffer_automerge' './rope_automerge' './line_gap_automerge' --export-markdown automerge.md
|
||||
|
||||
gap_buffer_svelte:
|
||||
mlton gap_buffer_svelte.mlb
|
||||
|
||||
gap_buffer_rust:
|
||||
mlton gap_buffer_rust.mlb
|
||||
|
||||
gap_buffer_seph:
|
||||
mlton gap_buffer_seph.mlb
|
||||
|
||||
gap_buffer_automerge:
|
||||
mlton gap_buffer_automerge.mlb
|
||||
|
||||
line_gap_svelte:
|
||||
mlton line_gap_svelte.mlb
|
||||
|
||||
line_gap_rust:
|
||||
mlton line_gap_rust.mlb
|
||||
|
||||
line_gap_seph:
|
||||
mlton line_gap_seph.mlb
|
||||
|
||||
line_gap_automerge:
|
||||
mlton line_gap_automerge.mlb
|
||||
|
||||
rope_svelte:
|
||||
mlton rope_svelte.mlb
|
||||
|
||||
rope_rust:
|
||||
mlton rope_rust.mlb
|
||||
|
||||
rope_seph:
|
||||
mlton rope_seph.mlb
|
||||
|
||||
rope_automerge:
|
||||
mlton rope_automerge.mlb
|
||||
|
||||
clean:
|
||||
rm -f gap_buffer_svelte gap_buffer_rust gap_buffer_seph gap_buffer_automerge
|
||||
rm -f line_gap_svelte line_gap_rust line_gap_seph line_gap_automerge
|
||||
rm -f rope_svelte rope_rust rope_seph rope_automerge
|
||||
rm -f svelte.md rust.md seph.md automerge.md
|
||||
13
brolib-sml/bench/gap_buffer_automerge.mlb
Normal file
13
brolib-sml/bench/gap_buffer_automerge.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/automerge.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/gap_buffer.sml
|
||||
gap_buffer_automerge.sml
|
||||
13
brolib-sml/bench/gap_buffer_automerge.sml
Normal file
13
brolib-sml/bench/gap_buffer_automerge.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure GapBufferAutomerge: TRANSACTION =
|
||||
struct
|
||||
type t = GapBuffer.t
|
||||
val empty = GapBuffer.empty
|
||||
val insert = GapBuffer.insert
|
||||
val delete = GapBuffer.delete
|
||||
val toString = GapBuffer.toString
|
||||
val txns = AutomergePaper.txns
|
||||
end
|
||||
|
||||
structure Main = Run(GapBufferAutomerge)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/gap_buffer_rust.mlb
Normal file
13
brolib-sml/bench/gap_buffer_rust.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/rust.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/gap_buffer.sml
|
||||
gap_buffer_rust.sml
|
||||
13
brolib-sml/bench/gap_buffer_rust.sml
Normal file
13
brolib-sml/bench/gap_buffer_rust.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure GapBufferRust: TRANSACTION =
|
||||
struct
|
||||
type t = GapBuffer.t
|
||||
val empty = GapBuffer.empty
|
||||
val insert = GapBuffer.insert
|
||||
val delete = GapBuffer.delete
|
||||
val toString = GapBuffer.toString
|
||||
val txns = RustCode.txns
|
||||
end
|
||||
|
||||
structure Main = Run(GapBufferRust)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/gap_buffer_seph.mlb
Normal file
13
brolib-sml/bench/gap_buffer_seph.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/seph.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/gap_buffer.sml
|
||||
gap_buffer_seph.sml
|
||||
13
brolib-sml/bench/gap_buffer_seph.sml
Normal file
13
brolib-sml/bench/gap_buffer_seph.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure GapBufferSeph: TRANSACTION =
|
||||
struct
|
||||
type t = GapBuffer.t
|
||||
val empty = GapBuffer.empty
|
||||
val insert = GapBuffer.insert
|
||||
val delete = GapBuffer.delete
|
||||
val toString = GapBuffer.toString
|
||||
val txns = SephBlog.txns
|
||||
end
|
||||
|
||||
structure Main = Run(GapBufferSeph)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/gap_buffer_svelte.mlb
Normal file
13
brolib-sml/bench/gap_buffer_svelte.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/svelte.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/gap_buffer.sml
|
||||
gap_buffer_svelte.sml
|
||||
13
brolib-sml/bench/gap_buffer_svelte.sml
Normal file
13
brolib-sml/bench/gap_buffer_svelte.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure GapBufferSvelete: TRANSACTION =
|
||||
struct
|
||||
type t = GapBuffer.t
|
||||
val empty = GapBuffer.empty
|
||||
val insert = GapBuffer.insert
|
||||
val delete = GapBuffer.delete
|
||||
val toString = GapBuffer.toString
|
||||
val txns = SvelteComponent.txns
|
||||
end
|
||||
|
||||
structure Main = Run(GapBufferSvelete)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/line_gap_automerge.mlb
Normal file
13
brolib-sml/bench/line_gap_automerge.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/automerge.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/line_gap.sml
|
||||
line_gap_automerge.sml
|
||||
13
brolib-sml/bench/line_gap_automerge.sml
Normal file
13
brolib-sml/bench/line_gap_automerge.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure LineGapAutomerge: TRANSACTION =
|
||||
struct
|
||||
type t = LineGap.t
|
||||
val empty = LineGap.empty
|
||||
val insert = LineGap.insert
|
||||
val delete = LineGap.delete
|
||||
val toString = LineGap.toString
|
||||
val txns = AutomergePaper.txns
|
||||
end
|
||||
|
||||
structure Main = Run(LineGapAutomerge)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/line_gap_rust.mlb
Normal file
13
brolib-sml/bench/line_gap_rust.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/rust.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/line_gap.sml
|
||||
line_gap_rust.sml
|
||||
13
brolib-sml/bench/line_gap_rust.sml
Normal file
13
brolib-sml/bench/line_gap_rust.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure LineGapRust: TRANSACTION =
|
||||
struct
|
||||
type t = LineGap.t
|
||||
val empty = LineGap.empty
|
||||
val insert = LineGap.insert
|
||||
val delete = LineGap.delete
|
||||
val toString = LineGap.toString
|
||||
val txns = RustCode.txns
|
||||
end
|
||||
|
||||
structure Main = Run(LineGapRust)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/line_gap_seph.mlb
Normal file
13
brolib-sml/bench/line_gap_seph.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/seph.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/line_gap.sml
|
||||
line_gap_seph.sml
|
||||
13
brolib-sml/bench/line_gap_seph.sml
Normal file
13
brolib-sml/bench/line_gap_seph.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure LineGapSeph: TRANSACTION =
|
||||
struct
|
||||
type t = LineGap.t
|
||||
val empty = LineGap.empty
|
||||
val insert = LineGap.insert
|
||||
val delete = LineGap.delete
|
||||
val toString = LineGap.toString
|
||||
val txns = SephBlog.txns
|
||||
end
|
||||
|
||||
structure Main = Run(LineGapSeph)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/line_gap_svelte.mlb
Normal file
13
brolib-sml/bench/line_gap_svelte.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/svelte.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/line_gap.sml
|
||||
line_gap_svelte.sml
|
||||
13
brolib-sml/bench/line_gap_svelte.sml
Normal file
13
brolib-sml/bench/line_gap_svelte.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure LineGapSvelete: TRANSACTION =
|
||||
struct
|
||||
type t = LineGap.t
|
||||
val empty = LineGap.empty
|
||||
val insert = LineGap.insert
|
||||
val delete = LineGap.delete
|
||||
val toString = LineGap.toString
|
||||
val txns = SvelteComponent.txns
|
||||
end
|
||||
|
||||
structure Main = Run(LineGapSvelete)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/rope_automerge.mlb
Normal file
13
brolib-sml/bench/rope_automerge.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/automerge.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/tiny_rope.sml
|
||||
rope_automerge.sml
|
||||
13
brolib-sml/bench/rope_automerge.sml
Normal file
13
brolib-sml/bench/rope_automerge.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure RopeAutomerge: TRANSACTION =
|
||||
struct
|
||||
type t = TinyRope.t
|
||||
val empty = TinyRope.empty
|
||||
val insert = TinyRope.insert
|
||||
val delete = TinyRope.delete
|
||||
val toString = TinyRope.toString
|
||||
val txns = AutomergePaper.txns
|
||||
end
|
||||
|
||||
structure Main = Run(RopeAutomerge)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/rope_rust.mlb
Normal file
13
brolib-sml/bench/rope_rust.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/rust.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/tiny_rope.sml
|
||||
rope_rust.sml
|
||||
13
brolib-sml/bench/rope_rust.sml
Normal file
13
brolib-sml/bench/rope_rust.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure RopeRust: TRANSACTION =
|
||||
struct
|
||||
type t = TinyRope.t
|
||||
val empty = TinyRope.empty
|
||||
val insert = TinyRope.insert
|
||||
val delete = TinyRope.delete
|
||||
val toString = TinyRope.toString
|
||||
val txns = RustCode.txns
|
||||
end
|
||||
|
||||
structure Main = Run(RopeRust)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/rope_seph.mlb
Normal file
13
brolib-sml/bench/rope_seph.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/seph.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/tiny_rope.sml
|
||||
rope_seph.sml
|
||||
13
brolib-sml/bench/rope_seph.sml
Normal file
13
brolib-sml/bench/rope_seph.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure RopeSeph: TRANSACTION =
|
||||
struct
|
||||
type t = TinyRope.t
|
||||
val empty = TinyRope.empty
|
||||
val insert = TinyRope.insert
|
||||
val delete = TinyRope.delete
|
||||
val toString = TinyRope.toString
|
||||
val txns = SephBlog.txns
|
||||
end
|
||||
|
||||
structure Main = Run(RopeSeph)
|
||||
|
||||
val _ = Main.run ()
|
||||
13
brolib-sml/bench/rope_svelte.mlb
Normal file
13
brolib-sml/bench/rope_svelte.mlb
Normal file
@@ -0,0 +1,13 @@
|
||||
$(SML_LIB)/basis/basis.mlb
|
||||
|
||||
ann
|
||||
"allowVectorExps true"
|
||||
in
|
||||
../data-sets/svelte.sml
|
||||
end
|
||||
|
||||
transaction.sml
|
||||
run.sml
|
||||
|
||||
../src/tiny_rope.sml
|
||||
rope_svelte.sml
|
||||
13
brolib-sml/bench/rope_svelte.sml
Normal file
13
brolib-sml/bench/rope_svelte.sml
Normal file
@@ -0,0 +1,13 @@
|
||||
structure RopeSvelte: TRANSACTION =
|
||||
struct
|
||||
type t = TinyRope.t
|
||||
val empty = TinyRope.empty
|
||||
val insert = TinyRope.insert
|
||||
val delete = TinyRope.delete
|
||||
val toString = TinyRope.toString
|
||||
val txns = SvelteComponent.txns
|
||||
end
|
||||
|
||||
structure Main = Run(RopeSvelte)
|
||||
|
||||
val _ = Main.run ()
|
||||
23
brolib-sml/bench/run.sml
Normal file
23
brolib-sml/bench/run.sml
Normal file
@@ -0,0 +1,23 @@
|
||||
functor Run(Txn: TRANSACTION) =
|
||||
struct
|
||||
local
|
||||
fun folder ((pos, delNum, insStr), buffer) =
|
||||
let
|
||||
val buffer =
|
||||
if delNum > 0 then Txn.delete (pos, delNum, buffer) else buffer
|
||||
in
|
||||
if String.size insStr > 0 then Txn.insert (pos, insStr, buffer)
|
||||
else buffer
|
||||
end
|
||||
in
|
||||
fun runTxns () =
|
||||
Vector.foldl folder Txn.empty Txn.txns
|
||||
end
|
||||
|
||||
fun run () =
|
||||
let
|
||||
val buffer = runTxns ()
|
||||
in
|
||||
()
|
||||
end
|
||||
end
|
||||
9
brolib-sml/bench/transaction.sml
Normal file
9
brolib-sml/bench/transaction.sml
Normal file
@@ -0,0 +1,9 @@
|
||||
signature TRANSACTION =
|
||||
sig
|
||||
type t
|
||||
val empty: t
|
||||
val insert: int * string * t -> t
|
||||
val delete: int * int * t -> t
|
||||
val toString: t -> string
|
||||
val txns : (int * int * string) vector
|
||||
end
|
||||
Reference in New Issue
Block a user