xmlm

Xmlm is a pull-based XML parser for Gleam, in a similar style as the OCaml xmlm library.

Documentation & Usage

Hacking

Check out the justfile for various utilities and helpers. (You will need just installed to use it.)

XML Conformance Tests

Benchmarks

You can run various benchmarks with:

Note that the JavaScript benchmarks are fairly slow to run.

Profiling Erlang Code

Run the Erlang shell with gleam shell. Then input the following:

fprof:trace(start).
bench@run_in_shell:main().
fprof:trace(stop).
fprof:profile().
fprof:analyse({dest, "_output/profile.fprof"}).

If you want to profile using a longer file, you can run the following instead.

Input = bench@run_in_shell:make_input("/home/ryan/projects/gleam/xmlm/test/test_files/33397721_long.xml").
fprof:trace(start).
bench@run_in_shell:no_op(Input).
fprof:trace(stop).
fprof:profile().
fprof:analyse({dest, "_output/profile.fprof"}).

(You can also use bench@run_in_shell:count_start_signals(Input) rather than no_op.)

Once either one of the above finishes running (it shouldn’t take more than a few moments), then run just erlgrind to view the profile with kchachegrind.

Note that this requires both kcachegrind and erlgrind to be installed.

Roadmap

Acknowledgements

Very heavily inspired by OCaml’s xmlm package by Daniel Bünzli.

License

license MIT or Apache 2.0

Copyright (c) 2024 Ryan M. Moore

Licensed under the Apache License, Version 2.0 or the MIT license, at your option. This program may not be copied, modified, or distributed except according to those terms.

Search Document