json-model-compiler 2.0b32__tar.gz → 2.0b36__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. {json_model_compiler-2.0b32/site → json_model_compiler-2.0b36}/BACKLOG.md +56 -15
  2. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/BENCH.md +15 -5
  3. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/PKG-INFO +7 -7
  4. {json_model_compiler-2.0b32/site → json_model_compiler-2.0b36}/README.md +5 -4
  5. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/about.sh +13 -9
  6. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/docker/Dockerfile +2 -1
  7. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/analyze.py +58 -2
  8. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/clang.py +98 -9
  9. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/jmc.pod +29 -9
  10. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/irep.py +201 -59
  11. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/language.py +20 -2
  12. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/optim.py +33 -0
  13. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/perl.py +8 -2
  14. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/plpgsql.py +11 -0
  15. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/python.py +1 -0
  16. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/c/json-model.c +17 -14
  17. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/c/json-model.h +6 -6
  18. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/script.py +43 -13
  19. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/utils.py +81 -0
  20. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/xstatic.py +396 -73
  21. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model_compiler.egg-info/PKG-INFO +7 -7
  22. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model_compiler.egg-info/SOURCES.txt +32 -1
  23. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model_compiler.egg-info/requires.txt +1 -2
  24. json_model_compiler-2.0b36/models/test-schema.model.json +43 -0
  25. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/pyproject.toml +7 -5
  26. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36/site}/BACKLOG.md +56 -15
  27. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/BENCH.md +15 -5
  28. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36/site}/README.md +5 -4
  29. json_model_compiler-2.0b36/site/benchmarks/202510220b.csv +164 -0
  30. json_model_compiler-2.0b36/site/benchmarks/202510220b.json +296 -0
  31. json_model_compiler-2.0b36/site/benchmarks/202510220b.md +207 -0
  32. json_model_compiler-2.0b36/site/benchmarks/2025102400.csv +158 -0
  33. json_model_compiler-2.0b36/site/benchmarks/2025102400.json +296 -0
  34. json_model_compiler-2.0b36/site/benchmarks/2025102400.md +207 -0
  35. json_model_compiler-2.0b36/site/benchmarks/2025102402.csv +164 -0
  36. json_model_compiler-2.0b36/site/benchmarks/2025102402.json +296 -0
  37. json_model_compiler-2.0b36/site/benchmarks/2025102402.md +208 -0
  38. json_model_compiler-2.0b36/site/benchmarks/2025102700.csv +164 -0
  39. json_model_compiler-2.0b36/site/benchmarks/2025102700.json +296 -0
  40. json_model_compiler-2.0b36/site/benchmarks/2025102700.md +208 -0
  41. json_model_compiler-2.0b36/site/benchmarks/2025102705.csv +164 -0
  42. json_model_compiler-2.0b36/site/benchmarks/2025102705.json +296 -0
  43. json_model_compiler-2.0b36/site/benchmarks/2025102705.md +208 -0
  44. json_model_compiler-2.0b36/site/benchmarks/2025102900.csv +166 -0
  45. json_model_compiler-2.0b36/site/benchmarks/2025102900.json +296 -0
  46. json_model_compiler-2.0b36/site/benchmarks/2025102900.md +211 -0
  47. json_model_compiler-2.0b36/site/benchmarks/2025103000.csv +166 -0
  48. json_model_compiler-2.0b36/site/benchmarks/2025103000.json +296 -0
  49. json_model_compiler-2.0b36/site/benchmarks/2025103000.md +211 -0
  50. json_model_compiler-2.0b36/site/benchmarks/2025110100.csv +166 -0
  51. json_model_compiler-2.0b36/site/benchmarks/2025110100.json +296 -0
  52. json_model_compiler-2.0b36/site/benchmarks/2025110100.md +211 -0
  53. json_model_compiler-2.0b36/site/benchmarks/2025110500.csv +166 -0
  54. json_model_compiler-2.0b36/site/benchmarks/2025110500.json +296 -0
  55. json_model_compiler-2.0b36/site/benchmarks/2025110500.md +211 -0
  56. json_model_compiler-2.0b36/site/benchmarks/2025111100.csv +166 -0
  57. json_model_compiler-2.0b36/site/benchmarks/2025111100.json +296 -0
  58. json_model_compiler-2.0b36/site/benchmarks/2025111100.md +211 -0
  59. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/cover.md +1 -1
  60. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/index.html +31 -2
  61. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/.gitignore +0 -0
  62. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/.gitmodules +0 -0
  63. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/API.md +0 -0
  64. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/DESIGN.md +0 -0
  65. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/DEV.md +0 -0
  66. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/DOC.md +0 -0
  67. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/HOWTO.md +0 -0
  68. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/INTEGRATION.md +0 -0
  69. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/MANIFEST.in +0 -0
  70. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/Makefile +0 -0
  71. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/PUBS.md +0 -0
  72. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/SPEC.md +0 -0
  73. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/TUTO.md +0 -0
  74. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/docker/.dockerignore +0 -0
  75. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/docker/.gitignore +0 -0
  76. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/docker/Makefile +0 -0
  77. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/docker/README.md +0 -0
  78. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/docker/jmc +0 -0
  79. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/README.md +0 -0
  80. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/__init__.py +0 -0
  81. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/convert.py +0 -0
  82. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/clang_entry.c +0 -0
  83. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/clang_free.c +0 -0
  84. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/clang_init.c +0 -0
  85. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/clang_pcre2_fun.c +0 -0
  86. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/clang_re2_fun.c +0 -0
  87. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/java_free.java +0 -0
  88. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/java_init.java +0 -0
  89. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/javascript_exe.js +0 -0
  90. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/javascript_foot.js +0 -0
  91. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/javascript_free.js +0 -0
  92. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/javascript_head.js +0 -0
  93. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/javascript_init.js +0 -0
  94. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/javascript_main.js +0 -0
  95. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/perl_entry.pl +0 -0
  96. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/perl_exe.pl +0 -0
  97. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/perl_free.pl +0 -0
  98. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/perl_init.pl +0 -0
  99. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/perl_main.pl +0 -0
  100. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/perl_pkg.pl +0 -0
  101. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/plpgsql_entry.sql +0 -0
  102. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/python_entry.py +0 -0
  103. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/python_exe.py +0 -0
  104. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/python_free.py +0 -0
  105. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/python_init.py +0 -0
  106. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/data/python_main.py +0 -0
  107. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/export.py +0 -0
  108. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/java.py +0 -0
  109. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/javascript.py +0 -0
  110. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/model.py +0 -0
  111. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/mtypes.py +0 -0
  112. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/objmerge.py +0 -0
  113. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/recurse.py +0 -0
  114. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/resolver.py +0 -0
  115. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/Makefile +0 -0
  116. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/__init__.py +0 -0
  117. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/c/Makefile +0 -0
  118. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/c/main.c +0 -0
  119. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/.gitignore +0 -0
  120. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/Makefile +0 -0
  121. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/README.md +0 -0
  122. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/env.bash +0 -0
  123. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/Checker.java +0 -0
  124. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/GSON.java +0 -0
  125. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/JSON.java +0 -0
  126. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/JSONP.java +0 -0
  127. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/Jackson.java +0 -0
  128. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/Main.java +0 -0
  129. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/ModelChecker.java +0 -0
  130. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/Path.java +0 -0
  131. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/Report.java +0 -0
  132. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/json_model/Runtime.java +0 -0
  133. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/java/pom.xml +0 -0
  134. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/js/README.md +0 -0
  135. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/js/index.js +0 -0
  136. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/js/main.js +0 -0
  137. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/js/package.json +0 -0
  138. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/.gitignore +0 -0
  139. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/Changes +0 -0
  140. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/LICENSE +0 -0
  141. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/MANIFEST +0 -0
  142. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/Makefile.PL +0 -0
  143. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/README +0 -0
  144. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/ignore.txt +0 -0
  145. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/lib/JSON/JsonModel.pm +0 -0
  146. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/t/00-load.t +0 -0
  147. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/t/manifest.t +0 -0
  148. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/t/pod-coverage.t +0 -0
  149. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/t/pod.t +0 -0
  150. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/pl/xt/boilerplate.t +0 -0
  151. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/sql/META.json +0 -0
  152. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/sql/Makefile +0 -0
  153. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/sql/json_model--2.0.sql +0 -0
  154. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/sql/json_model.control +0 -0
  155. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/support.py +0 -0
  156. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/runtime/types.py +0 -0
  157. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model/url_cache.py +0 -0
  158. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model_compiler.egg-info/dependency_links.txt +0 -0
  159. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model_compiler.egg-info/entry_points.txt +0 -0
  160. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/json_model_compiler.egg-info/top_level.txt +0 -0
  161. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/ansiblelint-meta.model.json +0 -0
  162. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/cypress.model.json +0 -0
  163. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/diploma-arrete.model.json +0 -0
  164. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/diploma-export.model.json +0 -0
  165. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/everything.model.json +0 -0
  166. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/fresq.model.json +0 -0
  167. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/geo-easy.model.json +0 -0
  168. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/geo.model.json +0 -0
  169. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/jmc-ir.model.json +0 -0
  170. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-model-latest.model.json +0 -0
  171. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-model-moschin.model.json +0 -0
  172. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-model-no-merge.model.json +0 -0
  173. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-model-v1.model.json +0 -0
  174. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-model-v2-en.model.json +0 -0
  175. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-model-v2.model.json +0 -0
  176. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-model.model.json +0 -0
  177. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-01-fuzzy.model.json +0 -0
  178. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-01-nesting.model.json +0 -0
  179. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-01.model.json +0 -0
  180. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-02-fuzzy.model.json +0 -0
  181. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-02-nesting.model.json +0 -0
  182. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-02.model.json +0 -0
  183. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-03-fuzzy.model.json +0 -0
  184. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-03-nesting.model.json +0 -0
  185. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-03.model.json +0 -0
  186. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-04-fuzzy.model.json +0 -0
  187. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-04-mongodb.model.json +0 -0
  188. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-04-nesting.model.json +0 -0
  189. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-04.model.json +0 -0
  190. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-06-fuzzy.model.json +0 -0
  191. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-06.model.json +0 -0
  192. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-07-fuzzy.model.json +0 -0
  193. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-07.model.json +0 -0
  194. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-2019-09-fuzzy.model.json +0 -0
  195. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-2019-09.model.json +0 -0
  196. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-2020-12-fuzzy.model.json +0 -0
  197. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-2020-12-tight.model.json +0 -0
  198. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-2020-12.model.json +0 -0
  199. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-next-fuzzy.model.json +0 -0
  200. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-next.model.json +0 -0
  201. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-tight.model.json +0 -0
  202. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-tighter-loose.model.json +0 -0
  203. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-draft-tighter.model.json +0 -0
  204. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/json-schema-linter.model.json +0 -0
  205. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/jsound.model.json +0 -0
  206. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/l10n.model.json +0 -0
  207. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/lazygit.model.json +0 -0
  208. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/openapi-311-fuzzy.model.json +0 -0
  209. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/openapi-311-models.model.json +0 -0
  210. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/openapi-311.model.json +0 -0
  211. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/person.model.json +0 -0
  212. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/person2.model.json +0 -0
  213. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/models/pgxn.model.json +0 -0
  214. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/package.json +0 -0
  215. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/setup.cfg +0 -0
  216. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/API.md +0 -0
  217. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/DOC.md +0 -0
  218. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/DOCKER.md +0 -0
  219. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/HOWTO.md +0 -0
  220. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/PUBS.md +0 -0
  221. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/SPEC.md +0 -0
  222. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/TUTO.md +0 -0
  223. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/benchmarks/2025102200.csv +0 -0
  224. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/benchmarks/2025102200.json +0 -0
  225. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/benchmarks/2025102200.md +0 -0
  226. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/benchmarks/2025102201.csv +0 -0
  227. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/benchmarks/2025102201.json +0 -0
  228. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/benchmarks/2025102201.md +0 -0
  229. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/favicon.ico +0 -0
  230. {json_model_compiler-2.0b32 → json_model_compiler-2.0b36}/site/json_logo.svg +0 -0
@@ -2,41 +2,58 @@
2
2
 
3
3
  ## Current Tasks
4
4
 
5
- - [x] backend: optimize length-based non-empty string check
6
- - [x] backend: remove reporting expressions under no reporting
7
- - [x] backend: nullify reporting parameters under no reporting
8
- - [x] command: silent more cc warnings
9
- - [ ] backend: optimize pattern "res = E1; return res || E2;" (only one use)
10
- - [ ] backend: generate direct code for search constant on small sets
11
- - [ ] backend: fix `TRUE AND` in `mv-07/json-schema-draft-tight.sql`
12
- - [ ] backend: fix `unused but set variable` warning and remove `-Wno-…`
13
- - [ ] backend: useless computations in `mv-17/xor_01.pl`
5
+ - [x] tests: check how clang compares to gcc (maybe a few pc better)
6
+ - [x] static: partition long lists of properties based on first bytes
7
+ - [x] static: use more bytes for str hashing depending on min len
8
+ - [x] static: generate hexa constants for partition limits tests
9
+ - [x] static: use `continue` instead of long multi-if statements
10
+ - [x] c-backend: partition inlined str cset
11
+ - [x] static: or acceleration based on full or partial distinct mandatory props
12
+ - [x] static: set default C partition threshold to _6_
13
+ - [x] c-backend: replace `strcmp` with `memcmp` in runtime
14
+ - [x] backend: improve if patterns in some cases
15
+ - [x] pr: add explicit winner column to per case perf
16
+ - [x] model: simplify `{"": "$NONE"}`
17
+ - [x] ~model: avoid dead code in `mv-0f/dedup-002`~ (simple pair ok, multiple seldom useful)
18
+ - [ ] test: improve output determinism
19
+ - [ ] perf: compute performance overhead globally instead of per run
20
+ - [ ] static: xor acceleration based on distinct mandatory props
21
+ - [ ] static: merge partial mandatory prop discriminants
22
+ - [ ] static: merge may/must property handling, or not?
23
+ - [ ] static: take into account str _byte_ len when partitioning
24
+ - [ ] static: possibly use up to 8 bytes when hashing?
25
+ - [ ] static: fix hash size to depends on byte encoding, not str len
26
+ - [ ] perf: test partitioning for js, java, perl, python…
27
+ - [ ] perf: investigate best settings for js, java and python
28
+ - [ ] perf: allow to run with any docker image
29
+ - [ ] static: maybe skip must checks if all must props already seen
14
30
  - [ ] backend: cleanup unused assigned variable, see `mv-08/openapi-311.c`
15
- - [ ] static: improve likely hints, eg may only category
31
+ - [ ] backend: fix `unused but set variable` warning and remove `-Wno-…` (dead code)
16
32
  - [ ] backend: remove useless `ELSE NULL` see `mv-02/geo.sql`
33
+ - [ ] command: export before/after model optimization
34
+ - [ ] perf: experiment object matching with various mandatory/optional properties
35
+ - [ ] backend: optimize pattern "res = E1; return res || E2;" (only one use)
17
36
  - [ ] backend: optimize pattern "res = E; if (! res) ret F; res not used before set;"
18
37
  - [ ] backend: optimize pattern "{ decl X = ... ; res = f(X (once) ) }"
19
38
  - [ ] backend: simplify assignment patterns with ternary operator when available?
20
- - [ ] backend: consider applying language-specific formatting tools? `clang-format`, `flake8`…
39
+ - [ ] backend: consider applying language-specific formatting tools? `clang-format`, `black`…
21
40
  - [ ] c-backend: get pval string into a variable for strcmp unrolling and inlining
22
41
  - [ ] c-backend: add number of chunks limit to strcmp optimization
23
42
  - [ ] c-backend: strcmp to const inlining and unrolling for all instances
43
+ - [ ] c-backend: more typed cset optimizations?
24
44
  - [ ] static: partial discriminator with else?
25
45
  - [ ] static: optimize not string cst test?
26
- - [ ] perf: compute performance overhead globally instead of per run
27
46
  - [ ] tests: add ir optimized output (too large?)
47
+ - [ ] tests: drop language outputs for IR only?!
28
48
  - [ ] tests: add pytest ir tests
29
49
  - [ ] tests: add generated ir model check
30
- - [ ] tests: drop language outputs for IR only?!
31
50
  - [ ] tests: check generated IR with IR model
32
- - [ ] perf: experiment object matching with various mandatory/optional properties
33
51
  - [ ] static: close may/must? merge with open?
34
52
  - [ ] static: add a dynamic test for different strategies in object checking
35
53
  - [ ] backend: refactor ir optimizations
36
54
  - [ ] command: add direct ir to lang conversion
37
55
  - [ ] artifact: make work with dind (docker compose?)
38
56
  - [ ] static: recognize already compile objects and reuse function esp under no-reporting?
39
- - [ ] tests: check how clang compares to gcc
40
57
  - [ ] tests: add non regression tests to docker build
41
58
  - [ ] service: json to lang conversion API
42
59
  - [ ] api: web interface with caching and security
@@ -63,6 +80,7 @@
63
80
  - [ ] tests: parallelize per-case instead of per-dir?
64
81
  - [ ] static: shorten xor exit?
65
82
  - [ ] perf: profile some cases
83
+ - [ ] c-backend: use vector instructions for larger strcmp?
66
84
 
67
85
  ## Re Do
68
86
 
@@ -701,3 +719,26 @@
701
719
  - [x] perf: add launcher script
702
720
  - [x] c-backend: cleanup duplicated `json_is_boolean` calls
703
721
  - [x] c-backend: fix bad constant string expression syntax
722
+ - [x] backend: optimize length-based non-empty string check
723
+ - [x] backend: remove reporting expressions under no reporting
724
+ - [x] backend: nullify reporting parameters under no reporting
725
+ - [x] command: silent more cc warnings
726
+ - [x] c-backend: try with `clang` instead of `gcc`
727
+ - [x] static: improve likely hints depending on expectations
728
+ - [x] backend: fix `TRUE AND` in `mv-07/json-schema-draft-tight.sql` (late)
729
+ - [x] backend: useless computations in `mv-17/xor_01.pl`
730
+ - [x] static: for must-only scheme controlled by option
731
+ - [x] static: further improve likely hints
732
+ - [x] command: rename `--unroll-may-…` options for `--may-must-open-threshold`
733
+ - [x] command: set optimization parameters depending on target language
734
+ - [x] static: order must/may props by increasing size
735
+ - [x] command: fix bad mmo threshold initializations
736
+ - [x] static: shorten return on open one may no must/regs/defs
737
+ - [x] backend: optimize pattern "if (!? V) V = cst;"
738
+ - [x] backend: optimize pattern "V = C; if (!? V) ..."
739
+ - [x] backend: optimize pattern "V = E1; V = E2;"
740
+ - [x] c-backend: generate direct code for search constant on small str sets
741
+ - [x] static: add likely hints on array checks
742
+ - [x] perf: test max strcmp cset to set default default
743
+ - [x] pr: move out schema-to-model conversion
744
+ - [x] pr: adjust radar display to visible datasets
@@ -8,8 +8,18 @@ C, JS, Java (GSON, Jackson and JSONP using Johnzon) and Python with
8
8
 
9
9
  ## Recent Artifacts
10
10
 
11
- - [2025102201](benchmarks/2025102201.md) no predefs, jmc 2.0b31 vs jsc 11.11.1, 5 runs, 1000 iterations.
12
- - [2025102200](benchmarks/2025102200.md) no predefs, jmc 2.0b31 vs jsc 11.11.1, 5 runs, 1000 iterations.
11
+ - [2025111100](benchmarks/2025111100.md) clang, no predefs, jmc 2.0b36 vs jsc 12.2.1, 3 runs, 1000 iterations.
12
+ - [2025110500](benchmarks/2025110500.md) clang, no predefs, jmc 2.0b36 vs jsc 12.2.0, 3 runs, 1000 iterations.
13
+ - [2025110100](benchmarks/2025110100.md) clang, no predefs, jmc 2.0b35 vs jsc 12.2.0, 3 runs, 1000 iterations.
14
+ - [2025103000](benchmarks/2025103000.md) clang, no predefs, jmc 2.0b35 vs jsc 12.1.0, 3 runs, 1000 iterations.
15
+ - [2025102900](benchmarks/2025102900.md) clang, no predefs, jmc 2.0b35 vs jsc 12.0.0, 3 runs, 1000 iterations.
16
+ - [2025102705](benchmarks/2025102705.md) clang, no predefs, jmc 2.0b34 vs jsc 12.0.0, 5 runs, 1000 iterations.
17
+ - [2025102700](benchmarks/2025102700.md) clang, no predefs, jmc 2.0b34 vs jsc 12.0.0, 3 runs, 1000 iterations.
18
+ - [2025102402](benchmarks/2025102402.md) clang, no predefs, jmc 2.0b33 vs jsc 11.11.1, 7 runs, 1000 iterations.
19
+ - [2025102400](benchmarks/2025102400.md) clang, no predefs, jmc 2.0b33 vs jsc 11.11.1, 5 runs, 1000 iterations.
20
+ - [202510220b](benchmarks/202510220b.md) clang, no predefs, jmc 2.0b32 vs jsc 11.11.1, 5 runs, 1000 iterations.
21
+ - [2025102201](benchmarks/2025102201.md) gcc, no predefs, jmc 2.0b31 vs jsc 11.11.1, 5 runs, 1000 iterations.
22
+ - [2025102200](benchmarks/2025102200.md) gcc, no predefs, jmc 2.0b31 vs jsc 11.11.1, 5 runs, 1000 iterations.
13
23
 
14
24
  ## Benchmarking Script
15
25
 
@@ -22,11 +32,11 @@ for comparison using the Blaze CLI.
22
32
 
23
33
  It is typically started on a large host with the
24
34
  [`start_bench.sh` script](https://github.com/clairey-zx81/json-model/blob/main/tests/perf/start_bench.sh)
25
- which will span the necessary dockers, try `--help` for setting details:
35
+ which will span the necessary dockers:
26
36
 
27
37
  ```sh
28
- JMC=latest JMC_OPTS=--no-predef \
29
- nohup ./start_bench.sh latest -p 20 -l 1000 -r 5 --cap-py &
38
+ JMC=latest JMC_OPTS="--no-predef --cc=clang-20" \
39
+ nohup ./start_bench.sh latest -p 16 -l 1000 -r 5 &
30
40
  # in the generated directory, look for the summary markdown and radar json files.
31
41
  ```
32
42
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_model_compiler
3
- Version: 2.0b32
3
+ Version: 2.0b36
4
4
  Summary: JSON Model Tools
5
5
  Author: Fabien Coelho, Claire Yannou-Medrala
6
6
  License-Expression: CC0-1.0
@@ -15,7 +15,7 @@ Requires-Dist: requests
15
15
  Requires-Dist: google-re2
16
16
  Requires-Dist: pyyaml
17
17
  Requires-Dist: validators
18
- Requires-Dist: json-schema-utils
18
+ Requires-Dist: json-schema-utils>=0.8.5
19
19
  Provides-Extra: dev
20
20
  Requires-Dist: flake8; extra == "dev"
21
21
  Requires-Dist: ruff; extra == "dev"
@@ -24,7 +24,6 @@ Requires-Dist: pytest; extra == "dev"
24
24
  Requires-Dist: pytest-xdist[psutils]; extra == "dev"
25
25
  Requires-Dist: filelock; extra == "dev"
26
26
  Requires-Dist: ipython; extra == "dev"
27
- Requires-Dist: json_schema_utils; extra == "dev"
28
27
  Provides-Extra: dist
29
28
  Requires-Dist: build; extra == "dist"
30
29
  Requires-Dist: wheel; extra == "dist"
@@ -157,10 +156,11 @@ print("reasons:", reasons)
157
156
 
158
157
  See the [benchmark page](BENCH.md) for artifacts which compare various
159
158
  [JSON Model Compiler](https://github.com/clairey-zx81/json-model) runs (C, JS, Java, Python) with
160
- [Sourcemeta Blaze CLI](https://github.com/sourcemeta/jsonschema) using test cases from
161
- [JSON Schema Benchmark](https://github.com/sourcemeta-research/jsonschema-benchmark).
162
- Overall, JMC C implementation is about 33% faster than Blaze C++ on these tests,
163
- and JavaScript and Java/GSON implementations are only about 15% slower than Blaze.
159
+ [Sourcemeta Blaze CLI](https://github.com/sourcemeta/jsonschema) as a baseline using test cases
160
+ from [JSON Schema Benchmark](https://github.com/sourcemeta-research/jsonschema-benchmark).
161
+ Overall, JMC-C implementation fares over 50% faster than Blaze C++ and comes ahead 70% of the time
162
+ on the latest benchmarks tests, and JMC-JS and JMC-Java/GSON native implementations are on average
163
+ about 40% slower than Blaze C++, which given the intrinsic language capabilities is honorable.
164
164
 
165
165
  ## More Information
166
166
 
@@ -125,10 +125,11 @@ print("reasons:", reasons)
125
125
 
126
126
  See the [benchmark page](BENCH.md) for artifacts which compare various
127
127
  [JSON Model Compiler](https://github.com/clairey-zx81/json-model) runs (C, JS, Java, Python) with
128
- [Sourcemeta Blaze CLI](https://github.com/sourcemeta/jsonschema) using test cases from
129
- [JSON Schema Benchmark](https://github.com/sourcemeta-research/jsonschema-benchmark).
130
- Overall, JMC C implementation is about 33% faster than Blaze C++ on these tests,
131
- and JavaScript and Java/GSON implementations are only about 15% slower than Blaze.
128
+ [Sourcemeta Blaze CLI](https://github.com/sourcemeta/jsonschema) as a baseline using test cases
129
+ from [JSON Schema Benchmark](https://github.com/sourcemeta-research/jsonschema-benchmark).
130
+ Overall, JMC-C implementation fares over 50% faster than Blaze C++ and comes ahead 70% of the time
131
+ on the latest benchmarks tests, and JMC-JS and JMC-Java/GSON native implementations are on average
132
+ about 40% slower than Blaze C++, which given the intrinsic language capabilities is honorable.
132
133
 
133
134
  ## More Information
134
135
 
@@ -109,11 +109,15 @@ cloc --md \
109
109
  json_model/runtime \
110
110
  | sed -n -e '/SUM/s/\([0-9][0-9]*\)/**\1**/g;s/SUM:/**Total**/;/^$/,$p' | grep -v '^-[-|]*$'
111
111
 
112
- nmodels=$(echo tests/[mrb]*/*.model.json | wc -w)
113
- nschemas=$(echo tests/[mrb]*/*.schema.json | wc -w)
114
- modellocs=$(cat tests/[mrb]*/*.model.json | wc -l)
115
- nvalues=$(cat tests/[mrb]*/*.values.json | egrep '(true|false)' | wc -l)
116
- allvalues=$(( $nvalues + $nmodels + $nschemas ))
112
+ n_models=$(ls tests/[mrb]*/*.model.json | wc -l)
113
+ n_values=$(cat tests/[mrb]*/*.values.json | egrep '(true|false)' | wc -l)
114
+ n_value_files=$(ls tests/[mrb]*/*.values.json | wc -l)
115
+ n_schemas=$(echo tests/[mrb]*/*.schema.json | wc -w)
116
+ n_test_schemas=$(grep '^ "schema": {' tests/JSON-Schema-Test-Suite/tests/*/*.json | wc -l)
117
+ n_test_files=$(ls tests/JSON-Schema-Test-Suite/tests/*/*.json | wc -l)
118
+ model_locs=$(cat tests/[mrb]*/*.model.json | wc -l)
119
+
120
+ all_values=$(( $n_values + $n_models + $n_value_files + $n_schemas + $n_test_schemas + $n_test_files ))
117
121
 
118
122
  cat <<EOF
119
123
 
@@ -125,8 +129,8 @@ Test models cover the various features of JSON Model.
125
129
  Each model is tested for each target language (Python, C, JavaScript, PL/pgSQL, Perl, Java)
126
130
  on a set of test vectors.
127
131
 
128
- - number of JSON models: $nmodels
129
- - total JSON model locs: $modellocs
130
- - number of test vector JSON values: $nvalues
131
- - all tested JSON values (including models and generated schemas): $allvalues
132
+ - number of JSON models: $n_models
133
+ - total JSON model locs: $model_locs
134
+ - number of test vector JSON values: $n_values
135
+ - all tested JSON values (including models, generated schemas and test suite schemas): $all_values
132
136
  EOF
@@ -10,7 +10,8 @@ ARG JSU=main
10
10
  RUN apt update ; \
11
11
  apt upgrade -y ; \
12
12
  apt install -y --no-install-recommends --fix-missing \
13
- git ca-certificates libtool m4 time automake make pkgconf gcc g++ texinfo jq curl less \
13
+ git ca-certificates libtool m4 time automake make pkgconf gcc g++ clang-20 \
14
+ texinfo jq curl less \
14
15
  nano vim libpcre2-dev libre2-dev libjansson-dev \
15
16
  python3 python-is-python3 python3-venv python3-pip \
16
17
  perl libre-engine-re2-perl libjson-maybexs-perl libcpanel-json-xs-perl libdatetime-hires-perl \
@@ -4,8 +4,8 @@
4
4
  import functools
5
5
  import re
6
6
 
7
- from .mtypes import UnknownModel, ModelPath, ModelType, ModelFilter
8
- from .utils import log, CONST_RE, is_regex
7
+ from .mtypes import UnknownModel, ModelPath, ModelType, ModelFilter, ModelObject, ModelArray
8
+ from .utils import log, CONST_RE, is_regex, is_a_simple_object
9
9
  from .recurse import recModel, allFlt, noRwt
10
10
  from .model import JsonModel
11
11
  from .runtime import ConstSet
@@ -512,3 +512,59 @@ def disjunct_analyse(jm: JsonModel, model: ModelType, mpath: ModelPath, lists: b
512
512
  disjuncts.append((prop, ctype, lmi))
513
513
  # final result
514
514
  return disjuncts, all_const_props, list(rejected)
515
+
516
+ def incompatible_prop(prop: str, obj: ModelObject) -> bool:
517
+ """Is this property incompatible with the object model?"""
518
+ for p, m in obj.items():
519
+ if p == "":
520
+ if m != "$NONE": # default object
521
+ return False
522
+ elif p[0] == "#":
523
+ pass
524
+ elif p[0] in ("_", "!", "?"):
525
+ if p[1:] == prop:
526
+ return False
527
+ elif p[0] == "/":
528
+ # TODO check regex!
529
+ return False
530
+ elif p[0] == "$":
531
+ # TODO check reference?
532
+ return False
533
+ elif p == prop:
534
+ return False
535
+ else:
536
+ pass
537
+ return True
538
+
539
+ # TODO partial: not all objets? shared prop names?
540
+ def distinct_prop_objects(jm, models: ModelArray) -> list[str|None]:
541
+ """Return distinct mandatory props to shorten/split or/xor object checks."""
542
+ if len(models) <= 1:
543
+ return [None] * len(models)
544
+ objs = [ultimate_model(jm, m) for m in models]
545
+ counts: list[dict[str, int]] = []
546
+ for idx, obj in enumerate(objs):
547
+ counts.append({})
548
+ if is_a_simple_object(obj):
549
+ for prop in obj.keys():
550
+ if not prop or prop[0] in "#?/$":
551
+ continue
552
+ # else mandatory property name
553
+ pname = prop[1:] if prop[0] in "!_" else prop
554
+ counts[idx][pname] = 0
555
+ for i, o in enumerate(objs):
556
+ if i != idx and incompatible_prop(pname, o):
557
+ counts[idx][pname] += 1
558
+ # keep the most selective property on each model
559
+ distinct_prop: list[str|None] = []
560
+ for uses in counts:
561
+ best = max(uses.values()) if uses else None
562
+ if best:
563
+ for prop, count in uses.items():
564
+ if count == best:
565
+ distinct_prop.append((prop, best == len(models) - 1))
566
+ break
567
+ else:
568
+ distinct_prop.append(None)
569
+ assert len(distinct_prop) == len(models)
570
+ return distinct_prop
@@ -3,7 +3,7 @@ import json
3
3
  from .language import Language, Block, Var, PropMap, ConstList
4
4
  from .language import JsonExpr, BoolExpr, IntExpr, StrExpr, PathExpr, Expr
5
5
  from .mtypes import Jsonable, JsonScalar, Number, TestHint, Conditionals
6
- from .utils import log
6
+ from .utils import log, partition
7
7
 
8
8
  _ESC_TABLE = { '"': r'\"', "\\": "\\\\" }
9
9
 
@@ -71,18 +71,19 @@ class CLangJansson(Language):
71
71
  """
72
72
 
73
73
  def __init__(self, *,
74
- debug: bool = False,
75
- with_path: bool = True, with_report: bool = True, with_comment: bool = True,
76
- with_predef: bool = True, strcmp_opt: bool = True, byte_order: str = "le",
77
- inline: bool = True, with_hints: bool = True,
78
- relib: str = "pcre2", int_t: str = "int64_t"):
74
+ debug: bool = False,
75
+ with_path: bool = True, with_report: bool = True, with_comment: bool = True,
76
+ with_predef: bool = True, strcmp_opt: bool = True, byte_order: str = "le",
77
+ inline: bool = True, with_hints: bool = True, max_strcmp_cset: int = 64,
78
+ partition_threshold: int = 32, relib: str = "pcre2", int_t: str = "int64_t"
79
+ ):
79
80
 
80
81
  super().__init__(
81
82
  "C",
82
83
  with_path=with_path, with_report=with_report, with_comment=with_comment,
83
84
  not_op="!", and_op="&&", or_op="||", lcom="//",
84
85
  true="true", false="false", null="NULL", check_t="jm_check_fun_t", json_t="json_t *",
85
- path_t="jm_path_t", float_t="double", str_t="const char *",
86
+ path_t="jm_path_t", float_t="double", str_t="const char *", hash_t="uint32_t",
86
87
  match_t="bool" if relib == "pcre2" else "int", with_hints=with_hints,
87
88
  eoi=";", relib=relib, debug=debug, with_predef=with_predef,
88
89
  set_caps=(type(None), bool, int, float, str)) # type: ignore
@@ -95,6 +96,9 @@ class CLangJansson(Language):
95
96
  self._json_esc_table = str.maketrans(_ESC_TABLE)
96
97
  self._inline = "INLINE " if inline else ""
97
98
  self._strcmp_opt = strcmp_opt
99
+ self._max_strcmp_cset = max_strcmp_cset
100
+ # NOTE not necessary equal to the one in CodeGenerator
101
+ self._partition_threshold = partition_threshold
98
102
  self._byte_order = byte_order
99
103
 
100
104
  #
@@ -252,6 +256,18 @@ class CLangJansson(Language):
252
256
  def any_len(self, var: Var) -> IntExpr:
253
257
  return f"_any_len({var})"
254
258
 
259
+ def str_hash(self, val: Var, size: int = 1) -> IntExpr:
260
+ if size == 1:
261
+ return f"{val}[0]"
262
+ if self._byte_order == "le":
263
+ mask = "0x" + "00" * (size - 4) + "ff" * size
264
+ else:
265
+ mask = "0x" + "ff" * size + "00" * (size - 4)
266
+ expr = f"*((uint32_t *) ({val}))"
267
+ if size != 4:
268
+ expr = f"({expr}) & {mask}"
269
+ return f"({expr}) >> {8 * (size-4)}" if size != 4 and self._byte_order == "be" else expr
270
+
255
271
  #
256
272
  # misc expressions
257
273
  #
@@ -559,7 +575,70 @@ class CLangJansson(Language):
559
575
  r"}",
560
576
  ]
561
577
 
578
+ #
579
+ # CONSTANT SETS
580
+ #
581
+ # TODO other constants
582
+ # TODO generalize to other types
583
+ def _str_cset_opt(self, constants: ConstList) -> bool:
584
+ return (len(constants) < self._max_strcmp_cset and
585
+ all(map(lambda c: type(c) is str, constants)))
586
+
587
+ def _def_str_cset(self, name: str, constants: ConstList) -> Block:
588
+ return [ f"static {self._inline}bool {name}_str_test(const char *);" ]
589
+
590
+ def _part_expr(self, var: Var, part_code: dict[int, str]) -> str:
591
+ nparts = len(part_code)
592
+ if nparts == 1:
593
+ return list(part_code.values())[0]
594
+ elif nparts == 2:
595
+ first, second = min(part_code.keys()), max(part_code.keys())
596
+ return (f"({self.num_cmp(var, '<=', first, True)}) "
597
+ f"? (\n {part_code[first]} ) : (\n {part_code[second]} )")
598
+ else:
599
+ limit = list(sorted(part_code.keys()))[nparts // 2 - 1]
600
+ return (
601
+ f"({self.num_cmp(var, '<=', limit, True)})"
602
+ f" ? (\n {self._part_expr(var, {p: s for p, s in part_code.items() if p <= limit})})"
603
+ f" : (\n {self._part_expr(var, {p: s for p, s in part_code.items() if p > limit})})"
604
+ )
605
+
606
+ def _sub_str_cset(self, name: str, constants: ConstList) -> Block:
607
+ code = [
608
+ f"static {self._inline}bool {name}_str_test(const char *s)",
609
+ "{",
610
+ ]
611
+
612
+ names = set(constants)
613
+ partitioning = partition(names, self._partition_threshold, self._byte_order)
614
+ if partitioning is not None:
615
+ hash_size, partitions = partitioning
616
+ code.append(self._indent +
617
+ self.hash_var("hash", self.str_hash("s", hash_size), declare=True)[0])
618
+ else:
619
+ hash_size, partitions = 0, {0: names}
620
+
621
+ part_code = {
622
+ p: " || ".join(
623
+ (_str_cmp("s", json.dumps(s), self._byte_order, True) + f" // {self.esc(s)}\n")
624
+ for s in sorted(strs, key=lambda s: (len(s), s)))
625
+ for p, strs in partitions.items()
626
+ }
627
+
628
+ code += [
629
+ " return",
630
+ " " + self._part_expr("hash", part_code),
631
+ " ;",
632
+ "}"
633
+ ]
634
+ return code
635
+
636
+ def _in_str_cset(self, name: str, var: str, constants: ConstList) -> BoolExpr:
637
+ return f"{self.is_a(var, str)} && {name}_str_test(json_string_value({var}))"
638
+
562
639
  def def_cset(self, name: str, constants: ConstList) -> Block:
640
+ if self._str_cset_opt(constants):
641
+ return self._def_str_cset(name, constants)
563
642
  types = set(type(c) for c in constants)
564
643
  code = []
565
644
  if len(types) > 1:
@@ -567,6 +646,8 @@ class CLangJansson(Language):
567
646
  return code + [ f"static jm_constant_t {name}[{len(constants)}];" ]
568
647
 
569
648
  def sub_cset(self, name: str, constants: ConstList) -> Block:
649
+ if self._str_cset_opt(constants):
650
+ return self._sub_str_cset(name, constants)
570
651
  types = set(type(c) for c in constants)
571
652
  code = []
572
653
  if len(types) > 1:
@@ -590,12 +671,14 @@ class CLangJansson(Language):
590
671
  elif vtype is float:
591
672
  return f"(jm_constant_t) {{ cst_is_float, {{ .f = {self.value(var, float)} }} }}"
592
673
  elif vtype is str:
593
- return f"(jm_constant_t) {{ cst_is_string, {{ .s = {self.value(var, str)} }} }}"
674
+ return f"(jm_constant_t) {{ strlen({self.value(var, str)}) + 1, {{ .s = {self.value(var, str)} }} }}"
594
675
  else:
595
676
  raise NotImplementedError(f"type {vtype}")
596
677
 
597
678
  def in_cset(self, name: str, var: Var, constants: ConstList) -> BoolExpr:
598
679
  """Tell whether JSON variable var value of potential types is in set name."""
680
+ if self._str_cset_opt(constants):
681
+ return self._in_str_cset(name, var, constants)
599
682
  types = set(type(c) for c in constants)
600
683
  if len(types) == 1:
601
684
  tcs = types.pop()
@@ -615,17 +698,23 @@ class CLangJansson(Language):
615
698
  case float(f):
616
699
  return f"(jm_constant_t) {{ cst_is_float, {{ .f = {f} }} }}"
617
700
  case str(s):
618
- return f"(jm_constant_t) {{ cst_is_string, {{ .s = {self.esc(s)} }} }}"
701
+ bs = s.encode("UTF-8")
702
+ return f"(jm_constant_t) {{ {len(bs) + 1}, {{ .s = {self.esc(s)} }} }}"
619
703
  case _:
620
704
  raise Exception(f"unexpected constant value: {value}")
621
705
 
622
706
  def ini_cset(self, name: str, constants: ConstList) -> Block:
707
+ if self._str_cset_opt(constants):
708
+ return []
623
709
  code = self.lcom(f"initialize sorted set {name}")
624
710
  for i, cst in enumerate(constants):
625
711
  code.append(f"{name}[{i}] = {self._cst(cst)};")
626
712
  code.append(f"jm_sort_cst({name}, {len(constants)});")
627
713
  return code
628
714
 
715
+ def del_cset(self, name: str, constants: ConstList) -> Block:
716
+ return []
717
+
629
718
  def _fun(self, name: str, inline: bool = False) -> str:
630
719
  declare = f"static {self._inline}" if inline else "static "
631
720
  return f"{declare}bool {name}(const json_t *val, jm_path_t *path, jm_report_t *rep)"
@@ -17,11 +17,12 @@ B<jmc> - JSON Model Compiler
17
17
  [--gen {exec,module,code,none} | --executable | --module | --code | --no-gen]
18
18
  [--cc CC] [--cflags CFLAGS] [--cppflags CPPFLAGS] [--ldflags LDFLAGS]
19
19
  [--include [INCLUDE ...]] [--library [LIBRARY ...]] [--define [DEFINE ...]]
20
- [--javac JAVAC] [--jflags JFLAGS] [-[-no]-schema-version]
20
+ [--javac JAVAC] [--jflags JFLAGS] [-[-no]-schema-version] [--short-version]
21
21
  [--name NAME] [-[-no]-report] [--none] [--true] [--false] [--test-vector]
22
22
  [--map-threshold THRESHOLD] [--map-share] [-[-no]-strcmp-optimize] [--byte-order (le|be)]
23
- [--unroll-may-ratioi RATIO] [--unroll-may-threshold THRESHOLD]
24
- [-[-no]-predef] [--short-version]
23
+ [--may-must-open-threshold THRESHOLD] [--must-only-threshold THRESHOLD]
24
+ [--partition-threshold THRESHOLD] [--or-must-prop THRESHOLD]
25
+ [--max-strcmp-cset SIZE] [-[-no]-sort-must] [-[-no]-sort-may] [-[-no]-predef]
25
26
  [--op {P,U,J,N,E,C} | --preproc | --dump | --jdump | --nope | --export | --compile]
26
27
  [--output OUTPUT] model [values ...]
27
28
 
@@ -168,15 +169,30 @@ maximum number of props to inline property checks in objects.
168
169
 
169
170
  whether to share common maps, may result in smaller generated code.
170
171
 
171
- =item B<--unroll-may-ratio RATIO>
172
+ =item B<--may-must-open-threshold THRESHOLD>
172
173
 
173
- consider object property unrolling if the ratio of optional properties
174
- is below the provided ratio.
174
+ consider mmo object property scheme if the number of optional properties
175
+ is below the provided threshold, default is depends on target.
175
176
 
176
- =item B<--unroll-may-threshold THRESHOLD>
177
+ =item B<--must-only-threshold THRESHOLD>
177
178
 
178
- consider object property unrolling if the number of optional properties
179
- is below the provided threshold.
179
+ consider must-only object property scheme if the number of mandatory
180
+ properties is below the provided threshold, default depends on target.
181
+
182
+ =item B<--partition-threshold THRESHOLD>
183
+
184
+ number of properties to trigger partitioning inlined property checks,
185
+ default depends on target, 0 means no partitioning.
186
+
187
+ =item B<--or-must-prop THRESHOLD>
188
+
189
+ shortcut or-list based on full or partial discriminating mandatory properties
190
+ if length above threshold, default depends on target, 0 to disable.
191
+
192
+ =item B<--sort-must> B<--no-sort-must> B<--sort-may> B<--no-sort-may>
193
+
194
+ whether to sort must or may properties when checks are unrolled,
195
+ default is to preserve the initial order within each category.
180
196
 
181
197
  =item B<--predef> vs B<--no-predef>
182
198
 
@@ -216,6 +232,10 @@ generate inline hints.
216
232
 
217
233
  whether to optimize string comparisons in some cases.
218
234
 
235
+ =item B<--max-strcmp-cset SIZE>
236
+
237
+ maximum size for string constant set expansion.
238
+
219
239
  =item B<--byte-order ORDER>
220
240
 
221
241
  set byte order for string comparison, either C<le> (little endian) or C<be> (big endian).