Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should this move to be Rust-backed? #107

Closed
gjtorikian opened this issue Nov 12, 2019 · 3 comments · Fixed by #185
Closed

Should this move to be Rust-backed? #107

gjtorikian opened this issue Nov 12, 2019 · 3 comments · Fixed by #185

Comments

@gjtorikian
Copy link
Owner

This is primarily intended as a question to @kivikakk though I welcome any questions/concerns from other dependents.

Lately, I've been thinking about moving the backing library of this project from a C implementation to a Rust implementation. I have experience wrapping Rust crates in Ruby gems already.

Now, I love C. I cut my teeth on C. I think C has a lot to teach programmers about the fundamentals of software.

But I am old now, and I don't have the time or inclination to think about segfaults and memory leaks. And I like Rust. I think it's great.

Part of my concern about making the switch is that I don't know what lingering implications this might have. I like that comrak's stated goal is to "model the upstream cmark-gfm as closely as possible in terms of code structure." Are there any other issues I should be thinking about? In my mind, as long as the existing test suite passes, everything should be totally fine....right?

@kivikakk
Copy link
Collaborator

As long as the test suite passes, it should be fine. (And I'm in favour of such a change, definitely!)

I should say, though, that in part due to that design goal, Comrak isn't as performant as the main other CommonMark renderer, pulldown-cmark. Comparison using make bench from cmark (modified to redirect input instead of giving a filename):

$ make bench PROG=build/src/cmark-gfm
{ for x in `seq 1 20` ; do \
                /usr/bin/env time -p build/src/cmark-gfm </dev/null >/dev/null ; \
                /usr/bin/env time -p build/src/cmark-gfm < bench/benchinput.md >/dev/null ; \
                done \
        } 2>&1  | grep 'real' | awk '{print $2}' | python3 'bench/stats.py'
mean = 1.0915, median = 1.0850, stdev = 0.0556
$ make bench PROG=(which pulldown-cmark)
{ for x in `seq 1 20` ; do \
                /usr/bin/env time -p /Users/kivikakk/.cargo/bin/pulldown-cmark </dev/null >/dev/null ; \
                /usr/bin/env time -p /Users/kivikakk/.cargo/bin/pulldown-cmark < bench/benchinput.md >/dev/null ; \
                done \
        } 2>&1  | grep 'real' | awk '{print $2}' | python3 'bench/stats.py'
mean = 0.6930, median = 0.6900, stdev = 0.0223
$

It appears to pass all but one of the current spec tests; Comrak currently passes all but a different one.

@kivikakk
Copy link
Collaborator

(I guess the other thing is — extension support may vary from cmark-gfm. I try to follow it closely in Comrak.)

@gjtorikian
Copy link
Owner Author

Addressed by #186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants