alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Lift Framework example source code file (Jsonbench.scala)

This example Lift Framework source code file (Jsonbench.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lift Framework tags/keywords

a, a, abbrev, acronym, docbook, glossdiv, id, objectmapper, sgml, sgml, standard, standard, string, xml

The Lift Framework Jsonbench.scala source code

/**
 * Following libs are required to compile and run the benchmark:
 * - jackson-core-asl-1.4.1.jar
 * - jackson-mapper-asl-1.4.1.jar
 * - lift-json-???.jar
 */
object Jsonbench extends Benchmark {
  import scala.util.parsing.json.JSON
  import org.codehaus.jackson._
  import org.codehaus.jackson.map._
  import net.liftweb.json.JsonParser

  def main(args: Array[String]) = {
    benchmark("Scala std") { JSON.parse(json) }
    val mapper = new ObjectMapper
    benchmark("Jackson") { mapper.readValue(json, classOf[JsonNode]) }
    benchmark("lift-json") { JsonParser.parse(json) }
  }

  def benchmark(name: String)(f: => Any) = run(name, 50000, 50000)(f)

  val json = """
{
  "glossary": {
    "title": "example glossary",
    "GlossDiv": {
      "title": "S",
      "GlossList": {
        "GlossEntry": {
          "ID": "SGML",
	  "SortAs": "SGML",
	  "GlossTerm": "Standard Generalized Markup Language",
	  "Acronym": "SGML",
	  "Abbrev": "ISO 8879:1986",
	  "GlossDef": {
            "para": "A meta-markup language, used to create markup languages such as DocBook.",
	    "GlossSeeAlso": ["GML", "XML"]
          },
	  "GlossSee": "markup"
        }
      }
    }
  }
}
"""
}

Other Lift Framework examples (source code examples)

Here is a short list of links related to this Lift Framework Jsonbench.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.