Skip to content

Commit

Permalink
Support rescript 12 for ppx
Browse files Browse the repository at this point in the history
  • Loading branch information
DZakh committed Jan 12, 2025
1 parent 437a778 commit 0c3e439
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 201 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: rescript-schema-ppx
path: packages/rescript-schema-ppx/rescript-schema-ppx-9.0.0.tgz
path: packages/rescript-schema-ppx/rescript-schema-ppx-9.0.1.tgz

benchmark:
name: Benchmark
Expand Down
4 changes: 2 additions & 2 deletions packages/rescript-schema-ppx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rescript-schema-ppx",
"version": "9.0.0",
"version": "9.0.1",
"description": "ReScript PPX to generate rescript-schema from type",
"keywords": [
"ReScript",
Expand Down Expand Up @@ -32,6 +32,6 @@
"postinstall": "node ./install.cjs"
},
"peerDependencies": {
"rescript-schema": "^9.0.0 || 9.0.0-rc.1 || 9.0.0-rc.2"
"rescript-schema": "9.x"
}
}
2 changes: 1 addition & 1 deletion packages/rescript-schema-ppx/src/ppx/Structure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ and generatePolyvariantSchemaExpression row_fields =

and generateFieldSchemaExpression field =
let schema_expression = generateCoreTypeSchemaExpression field.core_type in
if field.is_optional then [%expr Obj.magic S.option [%e schema_expression]]
if field.is_optional then [%expr Obj.magic (S.option [%e schema_expression])]
else schema_expression

and generateVariantSchemaExpression constr_decls =
Expand Down
Loading

1 comment on commit 0c3e439

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 0c3e439 Previous: 437a778 Ratio
S.schema - make 1424229 ops/sec (±0.45%) 1372056 ops/sec (±1.72%) 0.96
S.schema - make + parse 107347 ops/sec (±1.38%) 108761 ops/sec (±0.72%) 1.01
S.schema - parse 51364549 ops/sec (±1.43%) 50964496 ops/sec (±2.21%) 0.99
S.schema - parse strict 19897913 ops/sec (±1.07%) 24427232 ops/sec (±1.55%) 1.23
S.schema - make + reverse 935209 ops/sec (±1.15%) 945525 ops/sec (±0.32%) 1.01
S.schema - make + reverse convert 193450 ops/sec (±0.66%) 188026 ops/sec (±0.55%) 0.97
S.schema - reverse convert 89510274 ops/sec (±3.09%) 57705385 ops/sec (±1.85%) 0.64
S.schema - reverse convert (compiled) 134529721 ops/sec (±4.75%) 140752092 ops/sec (±3.85%) 1.05
S.schema - assert 68159361 ops/sec (±2.02%) 54376737 ops/sec (±2.02%) 0.80
S.schema - assert (compiled) 75881348 ops/sec (±2.44%) 78006168 ops/sec (±2.52%) 1.03
S.schema - assert strict 22354056 ops/sec (±1.35%) 23304761 ops/sec (±1.16%) 1.04
S.object - make 1003822 ops/sec (±0.26%) 925739 ops/sec (±0.42%) 0.92
S.object - make + parse 88886 ops/sec (±0.35%) 89442 ops/sec (±0.43%) 1.01
S.object - parse 38757667 ops/sec (±1.09%) 35478421 ops/sec (±0.97%) 0.92
S.object - make + reverse 126380 ops/sec (±1.36%) 132008 ops/sec (±1.21%) 1.04
S.object - make + reverse convert 84436 ops/sec (±0.97%) 86941 ops/sec (±1.13%) 1.03
S.object - reverse convert 46517962 ops/sec (±2.14%) 45339155 ops/sec (±3.04%) 0.97
S.string - parse 68790186 ops/sec (±2.64%) 68562643 ops/sec (±2.42%) 1.00
S.string - reverse convert 69171162 ops/sec (±2.39%) 70490025 ops/sec (±2.40%) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.