-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(monorepo): reason-tree-sitter (#2312)
This moves in `reason-tree-sitter` to this Onivim 'monorepo' - the goal being to bring in `EditorCoreTypes` so that we can better represent byte/character indices in the type system. This will also let us test tree-sitter changes more easily against Onivim - sorry this collides with #1589 @CrossR - hopefully it won't be too bad to merge (and make it easier for us to iterate / test tree-sitter changes in Onivim)
- Loading branch information
Showing
42 changed files
with
225,130 additions
and
182 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
print_endline("== CORE == "); | ||
OniBenchLib.BenchFramework.cli(); | ||
|
||
print_endline("== TreeSitter == "); | ||
TreeSitterBenchLib.BenchFramework.cli(); | ||
|
||
print_endline("Done!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include Reperf.Make({ | ||
let config = Reperf.Config.create(~snapshotDir="bench/__snapshots__", ()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
open Treesitter; | ||
open BenchFramework; | ||
|
||
Printexc.record_backtrace(true); | ||
|
||
let jsonParser = Parser.json(); | ||
let cParser = Parser.c(); | ||
|
||
let simpleJson = "[1, \"2\", { \"test\": [1] }]"; | ||
|
||
let simpleC = "int main() { return 1; }"; | ||
|
||
let parse = (v: string, ()) => { | ||
let _ = Parser.parseString(jsonParser, v); | ||
(); | ||
}; | ||
|
||
let parseArray = (v: array(string), ()) => { | ||
let _ = ArrayParser.parse(jsonParser, None, v); | ||
(); | ||
}; | ||
|
||
let setup = () => (); | ||
let options = Reperf.Options.create(~iterations=10, ()); | ||
|
||
bench( | ||
~name="parseString: Small JSON", | ||
~options, | ||
~setup, | ||
~f=parse(simpleJson), | ||
(), | ||
); | ||
|
||
bench(~name="parseString: Small C", ~options, ~setup, ~f=parse(simpleC), ()); | ||
|
||
bench( | ||
~name="parseString: Large JSON (canada.json)", | ||
~options, | ||
~setup, | ||
~f=parse(TestData.largeJsonString), | ||
(), | ||
); | ||
|
||
bench( | ||
~name="parseString: Large C (sqlite3.c)", | ||
~options, | ||
~setup, | ||
~f=parse(TestData.largeCString), | ||
(), | ||
); | ||
|
||
bench( | ||
~name="parseArray: Large JSON (canada.json)", | ||
~options, | ||
~setup, | ||
~f=parseArray(TestData.largeJsonArray), | ||
(), | ||
); | ||
|
||
bench( | ||
~name="parseArray: Large C (sqlite3.c)", | ||
~options, | ||
~setup, | ||
~f=parseArray(TestData.largeCArray), | ||
(), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
open Treesitter; | ||
open BenchFramework; | ||
|
||
Printexc.record_backtrace(true); | ||
|
||
let cParser = Parser.c(); | ||
|
||
let (_, baseline) = ArrayParser.parse(cParser, None, TestData.largeCArray); | ||
|
||
let createDelta = () => { | ||
let _ = | ||
ArrayParser.Delta.create( | ||
baseline, | ||
190279, | ||
190280, | ||
[|"#define A", "#define B"|], | ||
); | ||
(); | ||
}; | ||
|
||
let delta = | ||
ArrayParser.Delta.create( | ||
baseline, | ||
190279, | ||
190280, | ||
[|"#define A", "#define B"|], | ||
); | ||
|
||
let reparse = () => { | ||
let _ = ArrayParser.parse(cParser, Some(delta), TestData.largeCArray); | ||
(); | ||
}; | ||
|
||
let setup = () => (); | ||
let options = Reperf.Options.create(~iterations=10, ()); | ||
|
||
bench( | ||
~name="[Incremental] C - ArrayParser.Delta.create", | ||
~options, | ||
~setup, | ||
~f=createDelta, | ||
(), | ||
); | ||
|
||
bench( | ||
~name="[Incremental] C - ArrayParser.parse w/ delta update", | ||
~options, | ||
~setup, | ||
~f=reparse, | ||
(), | ||
); |
Oops, something went wrong.