I used Scala with Lift-Json and working fine.
when i am testing with Dummy Data for Performance check, i am getting different figures means not comparable.
here goes my performance check
Data in Rows Weight ForRead (ms) Parse (ms)
10000 468.9 KB 55 441
20000 948.9 kb 96 544
30000 1.4 MB 97 563
**40000 1.9 MB 127 908**
50000 2.4 MB 90 990
100000 4.8 mb 115 1500
when i used 40k Rows dummy Data every time its showing 127-140 MS to read data but if i use 50K rows its going down to 85-90 ms.
please check my code once - here it is
implicit val formats = net.liftweb.json.DefaultFormats
val map = {
val mb = new scala.collection.mutable.HashMap[String, Any]() with scala.collection.mutable.SynchronizedMap[String, Any]
(1 to 40000).foreach { i =>
mb += "dummy%s".format(i) -> List("cat1", "hash1", 100, (System.currentTimeMillis()/1000).toInt)
}
mb.toMap
}
//val json1 = map.toString
val json = Extraction.decompose(map)
val jsonStrOut = Printer.pretty(JsonAST.render(json))
val fileName = "foo3.txt"
val fw = new FileWriter(fileName)
fw.write(jsonStrOut)
fw.close()
val t1 = System.currentTimeMillis()
val br : BufferedReader = new BufferedReader(new FileReader(fileName));
val sb:StringBuilder = new StringBuilder();
var line = br.readLine();
while (line != null) {
sb.append(line);
sb.append("\n");
line = br.readLine();
}
val content = sb.toString();
br.close()
println(System.currentTimeMillis() - t1)
val obj = parse(content).asInstanceOf[JObject].values
println(System.currentTimeMillis() - t1)
println(obj("dummy4"))
println(System.currentTimeMillis() - t1)
please provide suggestions why its showing like that.
sometimes System Performance also shows impact on performance time, i considered that also .. but same showing