Experimental rewrite of grotty to html conversion in Rust

The previous C code was troublesome.
- Didn't handle long lines
- I couldn't convince myself that it was free of memory safety issues
- Needed improving anyway, there are some formatting bugs. These are
  hard to fix in the current code.

I mostly replicated the formatting bugs of the old C implementation in
Rust, and possibly added a few new bugs as well. It's not a significant
improvement right now, more testing and fixing will be needed.

The performance of both implementations is comparable, with the Rust
version being slightly faster in many cases (and slower in some others).
I did spend more time trying to optimize this Rust version than I did
with the old C code. I initially tried a naive-ish conversion of the C
code to Rust, but that turned out to be much slower and I had to resort
to using regexes and different data structures fix that.
This commit is contained in:
Yorhel 2017-01-15 10:54:48 +01:00
parent 8a3af4aee2
commit 6114b17389
10 changed files with 534 additions and 300 deletions

View file

@ -2,18 +2,27 @@
all: ManUtils indexer
ManUtils: lib/ManUtils/Build
cd lib/ManUtils && perl Build.PL && ./Build install --install-base=inst
lib/ManUtils/Build: lib/ManUtils/Build.PL
cd lib/ManUtils && perl Build.PL
ManUtils: lib/ManUtils/inst/lib/perl5/x86_64-linux/ManUtils.pm
lib/ManUtils/inst/lib/perl5/x86_64-linux/ManUtils.pm: lib/ManUtils/Build.PL lib/ManUtils/ManUtils.pm lib/ManUtils/ManUtils.xs web/target/release/libweb.a
test lib/ManUtils/ManUtils.xs -ot web/target/release/libweb.a && touch -r web/target/release/libweb.a lib/ManUtils/ManUtils.xs
cd lib/ManUtils && perl Build.PL && ./Build install --install-base=inst
touch lib/ManUtils/inst/lib/perl5/x86_64-linux/ManUtils.pm
web/target/release/libweb.a: web/Cargo.toml web/src/*.rs
cd web && cargo build --release
#strip --strip-unneeded web/target/release/libweb.a
indexer: indexer/target/release/indexer
indexer/target/release/indexer: indexer/Cargo.toml indexer/src/*.rs
cd indexer && cargo build --release
clean:
cd lib/ManUtils && ./Build distclean
rm -rf lib/ManUtils/inst
cd indexer && cargo clean
cd web && cargo clean