Giter Club home page Giter Club logo

showdownj's Introduction

This tiny project is aimed to investigate ways of processing of Markdown markup language for Scala projects. It was inspired by the article of Brian Carper "Clojure and Markdown (and Javascript and Java and...)"

The project provides a trivial Scala API to process Markdown markup based on three implementations:

  • MarkdownJ is a pure Java library
  • Showdown is a JavaScript implementation of Markdown, so it's possible to call it from Java using JavaScript implementations (this is the way Brian Carper proposed). I chose
    • Mozilla Rhino. Rhino permits to run JS on-the-fly and to compile it. As Showdown JavaScript is static, I compile it on the first run and use compiled function on the subsequent runs.
    • Java6 Scripting (which is basically Rhino, according to this article)

Benchmark

Along with the library you may find a simple benchmark comparing all three methods described above. Do not trust absolute numbers blindly, as every run does Markdown source processing, transformation to XML and then compares resulting XML to the reference one.

Average time to process long Markdown document (Markdown syntax description):

  • Java6 = 322 ms
  • Rhino = 312 ms
  • MarkdownJ = 183 ms

You may notice there is almost no difference between "compiled function" performance of Rhino and usual Java6 scripting.

Tests run with JDK 1.6 on MacBookPro 2.53GHz

Special note for Apple VM

If you have trouble running JavaScript engine in Java6 under Mac OSX, "How to include JavaScript engine in Apple's Java 6 VM" has a good recipe.

showdownj's People

Contributors

alaz avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

markusschlegel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.