Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix renderToStream #200

Merged
merged 29 commits into from
Jan 22, 2025
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3b83a0f
Try resources on arch
davesnx Jan 17, 2025
527daaf
ship extract cli as a esbuild plugin
davesnx Jan 17, 2025
fee5f1a
Fix test with-stdout-to
davesnx Jan 17, 2025
c7fa14d
improve error messages of extract-cc
davesnx Jan 17, 2025
4419a64
extract function as a package
davesnx Jan 17, 2025
6c349fe
only generate bootstrap if file is different
davesnx Jan 17, 2025
1486514
esbuild plugin adds bootstrap and webpack_require
davesnx Jan 17, 2025
97f7aa3
random readme changes
davesnx Jan 17, 2025
ad9d1e2
fix alias
davesnx Jan 17, 2025
341e05b
fix alias strings
davesnx Jan 20, 2025
69d4fd8
don't extract for all client
davesnx Jan 20, 2025
2e0d5db
install v20 node
davesnx Jan 20, 2025
54ee294
specify cache-dependency-path
davesnx Jan 20, 2025
1cc1e92
update without banner
davesnx Jan 20, 2025
49bf226
fix with rendering_resolved async components
davesnx Jan 21, 2025
7c15447
add nested suspense with errors
davesnx Jan 21, 2025
7e21588
Merge branch 'main' of github.com:ml-in-barcelona/server-reason-react…
davesnx Jan 21, 2025
d715f77
improve traces in the tests
davesnx Jan 21, 2025
8b86da2
remove Lwt.Infix
davesnx Jan 21, 2025
98e55cc
remove logging in server
davesnx Jan 21, 2025
6023487
fix issue where lowercase with innerhtml
davesnx Jan 21, 2025
0e660c9
improve bench by looking at gc.stat
davesnx Jan 21, 2025
d1ea0d3
raise on client c with import_module
davesnx Jan 22, 2025
82f7d9a
fix create-from-fetch
davesnx Jan 22, 2025
2e91428
remove cc from renderToStream
davesnx Jan 22, 2025
e84ef60
push list of suspenses as test
davesnx Jan 22, 2025
38f7726
ensure reorder works
davesnx Jan 22, 2025
9cb4348
add more tests
davesnx Jan 22, 2025
6525beb
minimize sleeps in test_stream
davesnx Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve bench by looking at gc.stat
davesnx committed Jan 21, 2025
commit 0e660c95d8bd3bfd4cd7147c175d020f1e2c1f62
2 changes: 2 additions & 0 deletions bench/dune
Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@
(modules once)
(libraries
unix
lwt
lwt.unix
server-reason-react.react
server-reason-react.reactDom
demo_shared_native)
55 changes: 55 additions & 0 deletions bench/once.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
let measure_alloc title f =
let before = Gc.stat () in
let result = f () in
let after = Gc.stat () in
Printf.printf "\n=== %s ===\n" title;
Printf.printf "Minor words: %f\n" (after.minor_words -. before.minor_words);
Printf.printf "Major words: %f\n" (after.major_words -. before.major_words);
Printf.printf "Minor collections: %d\n" (after.minor_collections - before.minor_collections);
result

let loop n f =
for _ = 1 to n do
f ()
done

let main () =
let filter_map_style () =
let element =
React.createElement "div"
(Stdlib.List.filter_map Fun.id
(List.init 50 (fun i ->
Some
(React.JSX.String (Printf.sprintf "prop%d" i, Printf.sprintf "prop%d" i, Printf.sprintf "value%d" i)))))
[]
in
let _ = ReactDOM.renderToStaticMarkup element in
()
in

let direct_style () =
let props =
List.init 50 (fun i ->
React.JSX.String (Printf.sprintf "prop%d" i, Printf.sprintf "prop%d" i, Printf.sprintf "value%d" i))
in
let element = React.createElement "div" props [] in
let _ = ReactDOM.renderToStaticMarkup element in
()
in

let render_hello_world () =
let _ = ReactDOM.renderToStaticMarkup (HelloWorld.make ()) in
()
in
let render_app () =
let _ = ReactDOM.renderToStaticMarkup (App.make ()) in
()
in

measure_alloc "Use filter_map" (fun () -> loop 10000 filter_map_style);
measure_alloc "Use list direct style" (fun () -> loop 10000 direct_style);
measure_alloc "Render <HelloWorld />" (fun () -> loop 10000 render_hello_world);
measure_alloc "Render <App />" (fun () -> loop 10000 render_app);
Lwt.return ()

let () = Lwt_main.run (main ())
5 changes: 0 additions & 5 deletions bench/once.re

This file was deleted.