Skip to content

Commit e82f58c

Browse files
committed
update for 1.0
1 parent 7b54729 commit e82f58c

File tree

5 files changed

+66
-67
lines changed

5 files changed

+66
-67
lines changed

CHANGELOG.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
# Changelog
22

3-
## 0.3.0
3+
## 1.0.0 - 2024-02-27
44

5-
- Update for Gleam 0.30.
5+
- Update for **Gleam** `~> 1.0`.
6+
- Some code cleanup and refactorings.
7+
- Also updates Benchee dep to `~> 1.3`.
68

7-
## 0.2.7
9+
## 0.3.0 - 2023-06-14
10+
11+
- Update for **Gleam** `~> 0.30`.
12+
13+
## 0.2.7 - 2023-01-20
814

915
- Improved readme instructions on how to run the Glychee.
1016

11-
## 0.2.6
17+
## 0.2.6 - 2023-01-01
1218

1319
- Instruct to use `gleam add glychee --dev` to add as a dev dependency, only.
1420

15-
## 0.2.5
21+
## 0.2.5 - 2023-01-01
1622

17-
- Fix logo on hexpm
23+
- Fix logo on *hexpm*.
1824

19-
## 0.2.4
25+
## 0.2.4 - 2023-01-01
2026

2127
- Readme
2228
- Typos
2329
- Logo
2430

25-
## 0.2.3
31+
## 0.2.3 - 2022-10-25
2632

2733
- Now just requires Gleam 0.24.0 instead of an unreleased nightly version.
2834

29-
## 0.2.2
35+
## 0.2.2 - 2022-10-25
3036

3137
- Changed Benchee configuration settings to:
3238

@@ -39,7 +45,7 @@
3945
]
4046
```
4147

42-
## v0.2.0
48+
## v0.2.0 - 2022-10-21
4349

4450
- Removed these dependencies: gleam's `stdlib`, `gleam_erlang`, and `gleeunit`,
4551
which means Glychee can be used in these projects to benchmark themselves.

README.md

+41-50
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ Named after *Gleam*, *Benchee* and their fruity [*Lychee*](https://en.wikipedia.
1515

1616
## Requirements
1717

18-
- Requires Gleam 0.30 or later.
18+
- Requires **Gleam 1.0** or later.
19+
- For benchmarking on target JavaScript see <https://hex.pm/packages/gleamy_bench>,
20+
as Glychee only allows benchmarking on target Erlang.
21+
- Glychee is dependency free except for *Benchee* and *Elixir*.
1922
- A recent Elixir and Hex must be installed. You might be required to run
2023
`mix local.hex` after installing Elixir.
21-
- Only allows benchmarking of target Erlang and not target JavaScript.
2224

2325
## Quick start
2426

@@ -28,68 +30,57 @@ Named after *Gleam*, *Benchee* and their fruity [*Lychee*](https://en.wikipedia.
2830
to benchmark with one or many `Data`.
2931
3. Run the benchmark:
3032

31-
```sh
33+
```shell
3234
gleam clean && \
3335
gleam build && \
34-
erl -pa ./build/dev/erlang/*/ebin -noshell -eval 'PROJECT_NAME@@main:run(my_benchmark)'
36+
gleam run -m my_benchmark
3537
```
3638

37-
... where `PROJECT_NAME` is set via the root level `name` property in `gleam.toml`.
38-
3939
### Full example
4040

4141
If you do not have a Gleam project yet, create it with:
4242

43-
```sh
43+
```shell
4444
gleam new foobar
4545
cd foobar
4646
```
4747

48-
Add **Glychee**: `gleam add glychee --dev`, then in your project create a file named
49-
`src/benchmark.gleam` with following source code:
50-
51-
```gleam
52-
if erlang {
53-
import gleam/int
54-
import gleam/list
55-
import glychee/benchmark
56-
57-
pub fn main() {
58-
benchmark.run(
59-
[
60-
benchmark.Function(
61-
label: "list.sort()",
62-
callable: fn(test_data) {
63-
fn() {
64-
list.sort(test_data, int.compare)
65-
}
66-
},
67-
),
68-
],
69-
[
70-
benchmark.Data(
71-
label: "pre-sorted list",
72-
data: list.range(1, 100_000),
73-
),
74-
benchmark.Data(
75-
label: "reversed list",
76-
data: list.range(1, 100_000) |> list.reverse,
77-
),
78-
],
79-
)
80-
}
81-
}
82-
```
83-
84-
Then run in your terminal via:
48+
To add and run a demo of **Glychee**:
49+
50+
1. `gleam add glychee --dev`
51+
2. In your project create a file named `src/my_benchmark.gleam` with following source code:
52+
53+
```gleam
54+
import gleam/int
55+
import gleam/list
56+
import glychee/benchmark
57+
58+
pub fn main() {
59+
benchmark.run(
60+
[
61+
benchmark.Function(label: "list.sort()", callable: fn(test_data) {
62+
fn() { list.sort(test_data, int.compare) }
63+
}),
64+
],
65+
[
66+
benchmark.Data(label: "pre-sorted list", data: list.range(1, 100_000)),
67+
benchmark.Data(
68+
label: "reversed list",
69+
data: list.range(1, 100_000)
70+
|> list.reverse,
71+
),
72+
],
73+
)
74+
}
75+
```
8576

86-
```sh
87-
gleam clean && \
88-
gleam build && \
89-
erl -pa ./build/dev/erlang/*/ebin -noshell -eval 'PROJECT_NAME@@main:run(benchmark)'
90-
```
77+
3. Then run in your terminal via:
9178

92-
... where `PROJECT_NAME` is set via the root level `name` property in `gleam.toml`.
79+
```shell
80+
gleam clean && \
81+
gleam build && \
82+
gleam run -m my_benchmark
83+
```
9384

9485
Now you can alter the functions and data specified in above's example to
9586
whichever function of your application or library you want to benchmark.

gleam.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name = "glychee"
2-
version = "0.3.0"
3-
gleam = ">= 0.30.0"
2+
version = "1.0.0"
3+
gleam = "~> 1.0"
44
licences = ["Apache-2.0"]
55
description = "Glychee: Easy access to Elixir's Benchee from Gleam!"
66
repository = { type = "github", user = "inoas", repo = "glychee" }
77
# links = [{ title = "Website", href = "https://gleam.run" }]
88
target = "erlang"
99

1010
[dependencies]
11-
benchee = "~> 1.1"
11+
benchee = "~> 1.3"
1212

1313
[documentation]
1414
pages = [

manifest.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# You typically do not need to edit this file
33

44
packages = [
5-
{ name = "benchee", version = "1.1.0", build_tools = ["mix"], requirements = ["deep_merge", "statistex"], otp_app = "benchee", source = "hex", outer_checksum = "7DA57D545003165A012B587077F6BA90B89210FD88074CE3C60CE239EB5E6D93" },
5+
{ name = "benchee", version = "1.3.0", build_tools = ["mix"], requirements = ["deep_merge", "statistex", "table"], otp_app = "benchee", source = "hex", outer_checksum = "34F4294068C11B2BD2EBF2C59AAC9C7DA26FFA0068AFDF3419F1B176E16C5F81" },
66
{ name = "deep_merge", version = "1.0.0", build_tools = ["mix"], requirements = [], otp_app = "deep_merge", source = "hex", outer_checksum = "CE708E5F094B9CD4E8F2BE4F00D2F4250C4095BE93F8CD6D018C753894885430" },
77
{ name = "statistex", version = "1.0.0", build_tools = ["mix"], requirements = [], otp_app = "statistex", source = "hex", outer_checksum = "FF9D8BEE7035028AB4742FF52FC80A2AA35CECE833CF5319009B52F1B5A86C27" },
8+
{ name = "table", version = "0.1.2", build_tools = ["mix"], requirements = [], otp_app = "table", source = "hex", outer_checksum = "7E99BC7EFEF806315C7E65640724BF165C3061CDC5D854060F74468367065029" },
89
]
910

1011
[requirements]
11-
benchee = { version = "~> 1.1" }
12+
benchee = { version = "~> 1.3" }

test/glychee_test.gleam

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/// There are no tests
2-
///
1+
import glychee/helpers
2+
33
pub fn main() {
4+
helpers.gleam_io_println("\nNotice: There are no tests!\n")
45
Nil
56
}

0 commit comments

Comments
 (0)