-
Notifications
You must be signed in to change notification settings - Fork 409
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
Preview: Upgrade to OCamlformat 0.27.0-preview1 (unreleased) #11059
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
version=0.26.2 | ||
version=0.27.0-preview1 | ||
profile=janestreet | ||
ocaml-version=4.08.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,10 @@ let write_subset base_dir library_index subset = | |
List.flatten | ||
(List.map | ||
(fun k -> | ||
List.map | ||
(fun j -> | ||
sprintf "M_%d_%d_%d_%d.f()" (library_index - 1) j mod_rows k) | ||
(count subsets_per_library)) | ||
List.map | ||
(fun j -> | ||
sprintf "M_%d_%d_%d_%d.f()" (library_index - 1) j mod_rows k) | ||
(count subsets_per_library)) | ||
(count mod_cols)) | ||
else | ||
List.map | ||
|
@@ -68,17 +68,21 @@ let write_lib ~base_dir ~lib ~dune = | |
|
||
let write base_dir = | ||
let () = Unix.mkdir base_dir 0o777 in | ||
let dune = {| | ||
let dune = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a bit wasteful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was changed in ocaml-ppx/ocamlformat#2480 but perhaps with a different case in mind. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When formatting with We don't mind if |
||
{| | ||
(library | ||
(name leaf) | ||
(libraries internal)) | ||
|} in | ||
|} | ||
in | ||
write_lib ~base_dir ~lib:Leaf ~dune; | ||
let dune = {| | ||
let dune = | ||
{| | ||
(library | ||
(name internal) | ||
(wrapped false)) | ||
|} in | ||
|} | ||
in | ||
write_lib ~base_dir ~lib:Internal ~dune | ||
;; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,41 +6,41 @@ open Stdune | |
[unzip] functions which make serialisation easier. *) | ||
type ('float, 'int) t = | ||
{ elapsed_time : 'float | ||
(** Real time elapsed since the process started and the process | ||
(** Real time elapsed since the process started and the process | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that the comments beginnings are aligned with the field they're documenting. |
||
finished. *) | ||
; user_cpu_time : 'float | ||
(** The amount of CPU time spent in user mode during the process. Other | ||
(** The amount of CPU time spent in user mode during the process. Other | ||
processes and blocked time are not included. *) | ||
; system_cpu_time : 'float | ||
(** The amount of CPU time spent in kernel mode during the process. | ||
(** The amount of CPU time spent in kernel mode during the process. | ||
Similar to user time, other processes and time spent blocked by | ||
other processes are not counted. *) | ||
; minor_words : 'float | ||
(** Number of words allocated in the minor heap since the program was | ||
(** Number of words allocated in the minor heap since the program was | ||
started. *) | ||
; promoted_words : 'float | ||
(** Number of words that have been promoted from the minor to the major | ||
(** Number of words that have been promoted from the minor to the major | ||
heap since the program was started. *) | ||
; major_words : 'float | ||
(** Number of words allocated in the major heap since the program was | ||
(** Number of words allocated in the major heap since the program was | ||
started. *) | ||
; minor_collections : 'int | ||
(** Number of minor collections since the program was started. *) | ||
(** Number of minor collections since the program was started. *) | ||
; major_collections : 'int | ||
(** Number of major collection cycles completed since the program was | ||
(** Number of major collection cycles completed since the program was | ||
started. *) | ||
; heap_words : 'int (** Total size of the major heap, in words. *) | ||
; heap_chunks : 'int | ||
(** Number of contiguous pieces of memory that make up the major heap. *) | ||
(** Number of contiguous pieces of memory that make up the major heap. *) | ||
; live_words : 'int | ||
(** Number of words of live data in the major heap, including the header | ||
(** Number of words of live data in the major heap, including the header | ||
words. *) | ||
; live_blocks : 'int (** Number of live blocks in the major heap. *) | ||
; free_words : 'int (** Number of words in the free list. *) | ||
; free_blocks : 'int (** Number of blocks in the free list. *) | ||
; largest_free : 'int (** Size (in words) of the largest block in the free list. *) | ||
; fragments : 'int | ||
(** Number of wasted words due to fragmentation. These are 1-words free | ||
(** Number of wasted words due to fragmentation. These are 1-words free | ||
blocks placed between two live blocks. They are not available for | ||
allocation. *) | ||
; compactions : 'int (** Number of heap compactions since the program was started. *) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,56 +8,54 @@ let root = "." | |
let short_path = "a/b/c" | ||
let long_path = List.init 20 ~f:(fun _ -> "foo-bar-baz") |> String.concat ~sep:"/" | ||
|
||
let%bench_fun ("is_root" [@params | ||
path | ||
= [ "root", "." | ||
; "short path", short_path | ||
; "long path", long_path | ||
]]) | ||
let%bench_fun ("is_root" | ||
[@params | ||
path = [ "root", "."; "short path", short_path; "long path", long_path ]]) | ||
= | ||
fun () -> ignore (Fpath.is_root path) | ||
;; | ||
|
||
let%bench_fun ("reach" [@params | ||
t | ||
= [ "from root long path", (long_path, root) | ||
; "from root short path", (short_path, root) | ||
; "reach root from short path", (root, short_path) | ||
; "reach root from long path", (root, long_path) | ||
; ( "reach long path from similar long path" | ||
, ( Filename.concat long_path "a" | ||
, Filename.concat long_path "b" ) ) | ||
; ( "reach short path from similar short path" | ||
, ( Filename.concat short_path "a" | ||
, Filename.concat short_path "b" ) ) | ||
]]) | ||
let%bench_fun ("reach" | ||
[@params | ||
t | ||
= [ "from root long path", (long_path, root) | ||
; "from root short path", (short_path, root) | ||
; "reach root from short path", (root, short_path) | ||
; "reach root from long path", (root, long_path) | ||
; ( "reach long path from similar long path" | ||
, (Filename.concat long_path "a", Filename.concat long_path "b") ) | ||
; ( "reach short path from similar short path" | ||
, (Filename.concat short_path "a", Filename.concat short_path "b") ) | ||
]]) | ||
= | ||
let t, from = t in | ||
let t = Path.of_string t in | ||
let from = Path.of_string from in | ||
fun () -> ignore (Path.reach t ~from) | ||
;; | ||
|
||
let%bench_fun ("Path.Local.relative" [@params | ||
t | ||
= [ "left root", (".", long_path) | ||
; "right root", (long_path, ".") | ||
; "short paths", (short_path, short_path) | ||
; "long paths", (long_path, long_path) | ||
]]) | ||
let%bench_fun ("Path.Local.relative" | ||
[@params | ||
t | ||
= [ "left root", (".", long_path) | ||
; "right root", (long_path, ".") | ||
; "short paths", (short_path, short_path) | ||
; "long paths", (long_path, long_path) | ||
]]) | ||
= | ||
let x, y = t in | ||
let x = Path.Local.of_string x in | ||
fun () -> ignore (Path.Local.relative x y) | ||
;; | ||
|
||
let%bench_fun ("Path.Local.append" [@params | ||
t | ||
= [ "left root", (".", long_path) | ||
; "right root", (long_path, ".") | ||
; "short paths", (short_path, short_path) | ||
; "long paths", (long_path, long_path) | ||
]]) | ||
let%bench_fun ("Path.Local.append" | ||
[@params | ||
t | ||
= [ "left root", (".", long_path) | ||
; "right root", (long_path, ".") | ||
; "short paths", (short_path, short_path) | ||
; "long paths", (long_path, long_path) | ||
]]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much more readable, only a bit surprising where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was in fact indented by 2 starting from the opening parenthese. Here's a more intuitive indentation: ocaml-ppx/ocamlformat#2613 |
||
= | ||
let x, y = t in | ||
let x = Path.Local.of_string x in | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that the function bodies are indented by two from the
fun
and not from the(
in front offun
. Seems more consistent.