kolasu icon indicating copy to clipboard operation
kolasu copied to clipboard

Measure performance of a couple of parsers w.r.t Kolasu 1.5

Open ftomassetti opened this issue 1 year ago • 6 comments

ftomassetti avatar Jun 17 '24 07:06 ftomassetti

Would it make sense to compare Kolasu with ANTLR v4 and Xtext?

  • I'm building here a maven project to programmatically measure the performances of a few parsers: https://github.com/psuzzi/parse-test

psuzzi avatar Aug 14 '24 15:08 psuzzi

Initial results comparing Kolasu to pure-ANTLR on parsing the same set of 90 files suggest that:

  • speed: Kolasu takes approximately 65 times longer to parse the same file set.
  • mem: Kolasu uses approx. 18% more memory
INFO: KOLASU FULL TEST
{
  "folder_path" : "/home/runner/work/parse-test/parse-test/parse-test-benchmark/target/test-classes/arithmetic_expr_gen",
  "number_of_files" : 90,
  "total_parsing_time_ms" : 36216,
  "total_memory_used_kb" : 339968
}
INFO: ANTLR FULL TEST
{
  "folder_path" : "/home/runner/work/parse-test/parse-test/parse-test-benchmark/target/test-classes/arithmetic_expr_gen",
  "number_of_files" : 90,
  "total_parsing_time_ms" : 556,
  "total_memory_used_kb" : 287662
}

Note:

  • my benchmark is a relatively new project, but you are welcome to check and edit the benchmarks available in: https://github.com/psuzzi/parse-test/tree/master/parse-test-benchmark/src/main/kotlin/dev/algo/parsetest/benchmark
  • The Kolasu parser builds the AST via Visitor, while the Antlr parser just returns the ParseTree

psuzzi avatar Aug 17 '24 22:08 psuzzi

Hi @psuzzi sorry for the late reply. This issue is indeed very poorly written, but what we meant was that we wanted to compare the performance of parsers built with 1.5 and with the branch currently under development (1.6). This new branch includes very significant changes and we wonder about the impact of those changes on performance. I think the comparison with ANTLR is also interesting, as we can deduct what kind of overhead we put on top of ANTLR. Thank you for performing such comparison.

ftomassetti avatar Aug 19 '24 12:08 ftomassetti

Thanks for the clarification. In the benchmark repository, I added a new issue Add Kolasu 1.6 to the comparison , and I stopped the efforts for solving Xtext integration issues, as it makes little sense.

psuzzi avatar Aug 20 '24 20:08 psuzzi

I can now test with multiple versions of Kolasu, but I can't get 1.6

I observed there is no 1.6.0-* version of kolasu released on maven central.

  • Do you have a different repository, where I can fetch it?

Otherwise, I can build the 1.6.0-Alpha1 (tag) or 1.6.0-Alpha2-SNAPSHOT (current main), and add the libraries to the project. In this second case, correct me if wrong, I will need to build both core-1.6.0-Alpha2-SNAPSHOT.jar and ast-jvm-1.6.0-Alpha2-SNAPSHOT.jar, but then I have a dependency issue with reaktive's PublishSubjectBuilderKt.

  • Do you have documented build instructions?

c/c @ftomassetti

psuzzi avatar Sep 04 '24 14:09 psuzzi

Hi Patrik. 1.6 has not yet been released on Maven Central and it is under development. At this time is not documented so I would not invest time on it, and working that out would be too time consuming

ftomassetti avatar Sep 06 '24 13:09 ftomassetti