-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
452 additions
and
34 deletions.
There are no files selected for viewing
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
Empty file.
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 |
---|---|---|
@@ -1,3 +1,16 @@ | ||
(executable | ||
(name bench) | ||
(libraries core_bench core_unix.command_unix)) | ||
(name main) | ||
(modules main) | ||
(libraries | ||
core_bench | ||
server-reason-react.react | ||
server-reason-react.reactDom) | ||
(preprocess | ||
(pps server-reason-react.ppx))) | ||
|
||
(executable | ||
(name once) | ||
(modules once) | ||
(libraries server-reason-react.react server-reason-react.reactDom) | ||
(preprocess | ||
(pps server-reason-react.ppx))) |
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 |
---|---|---|
@@ -1,37 +1,44 @@ | ||
open Core; | ||
open Core_bench; | ||
module Bench = Core_bench.Bench; | ||
|
||
module App = { | ||
module TinyApp = { | ||
[@react.component] | ||
let make = () => { | ||
<div className=["py-16 px-12"]> | ||
<h1 className="font-bold text-4xl"> | ||
{React.string("Home of the demos")} | ||
</h1> | ||
<ul className="flex flex-col gap-4"> | ||
<li> | ||
<a href="https://sancho.dev"> | ||
{React.string("https://sancho.dev")} | ||
</a> | ||
</li> | ||
<li> | ||
<a href="https://sancho.dev"> | ||
{React.string("https://sancho.dev")} | ||
</a> | ||
</li> | ||
<li> | ||
<a href="https://sancho.dev"> | ||
{React.string("https://sancho.dev")} | ||
</a> | ||
</li> | ||
</ul> | ||
</div>; | ||
<html> | ||
<body> | ||
<h1> {React.string("Hello World")} </h1> | ||
<p> {React.string("This is an example")} </p> | ||
</body> | ||
</html>; | ||
}; | ||
}; | ||
|
||
let bench_static = | ||
Bench.Test.create(~name="Parse static", () => | ||
ReactDOM.renderToStaticMarkup(<App />) | ||
let bench_static_markup_with_simple_app = | ||
Bench.Test.create(~name="bench_static_markup_with_simple_app", () => | ||
ReactDOM.renderToStaticMarkup(<TinyApp />) | ||
); | ||
|
||
Command_unix.run @@ Bench.make_command([bench_static]); | ||
let main = tests => { | ||
Printf.printf("\n\nRunning benchmarks\n"); | ||
Bench.bench( | ||
~analysis_configs= | ||
Bench.Analysis_config.default | ||
|> List.map( | ||
Bench.Analysis_config.with_error_estimation( | ||
~bootstrap_trials=10000, | ||
), | ||
), | ||
~run_config= | ||
Bench.Run_config.create( | ||
~quota=Bench.Quota.Num_calls(100000), | ||
~stabilize_gc_between_runs=true, | ||
~fork_each_benchmark=true, | ||
(), | ||
), | ||
~save_to_file= | ||
measurement => | ||
"bench/results/" ++ Bench.Measurement.name(measurement) ++ ".csv", | ||
tests, | ||
); | ||
}; | ||
|
||
main([bench_static_markup_with_simple_app]); |
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,13 @@ | ||
module TinyApp = { | ||
[@react.component] | ||
let make = () => { | ||
<html> | ||
<body> | ||
<h1> {React.string("Hello World")} </h1> | ||
<p> {React.string("This is an example")} </p> | ||
</body> | ||
</html>; | ||
}; | ||
}; | ||
|
||
print_endline(ReactDOM.renderToStaticMarkup(<TinyApp />)); |
Oops, something went wrong.