Skip to content

Commit 1417760

Browse files
committed
Add msgpack v6 to compare the performance
1 parent bfbd6e1 commit 1417760

File tree

5 files changed

+38
-4
lines changed

5 files changed

+38
-4
lines changed

msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public static class Options {
2626
//// upcast raw type // default:true : getNextType returns RAW?
2727
// allow readBinary and readBinaryLength to read str types // default:true
2828
// string decode malformed input action // default:report
29-
// string decode unmappable character action // default:report
30-
// byte buffer bulk allocation cache size
29+
// string decode unmappable character action // default:report // byte buffer bulk allocation cache size
3130
// byte buffer allocator
3231
// allow byte buffer reference : advanced option
3332
// raw size limit
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.msgpack.core;
2+
3+
import org.msgpack.annotation.Message;
4+
5+
@Message
6+
public class Person {
7+
public int id;
8+
public String name;
9+
10+
public Person() {}
11+
12+
13+
public Person(int id, String name) {
14+
this.id = id;
15+
this.name = name;
16+
}
17+
}

msgpack-core/src/test/scala/org/msgpack/core/MessagePackerTest.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
package org.msgpack.core
22
import org.scalatest.prop.PropertyChecks._
3+
import org.msgpack.MessagePack
4+
import org.msgpack.annotation.Message
35

46

7+
object MessagePackTest {
8+
9+
10+
11+
}
12+
513
class MessagePackerTest extends MessagePackSpec {
14+
15+
import MessagePackTest._
16+
617
"MessagePacker" should {
718

819
"serialize primitives" in {
@@ -17,7 +28,12 @@ class MessagePackerTest extends MessagePackSpec {
1728
}
1829

1930
"be used with 0.6.x" in {
31+
val p = new Person(1, "leo")
32+
val v6 = new MessagePack()
33+
v6.setClassLoader(classOf[Message].getClassLoader())
2034

35+
//v6.register(classOf[Person])
36+
val packed = v6.write(p)
2137

2238

2339
}

project/Build.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ object Build extends Build {
3636
crossPaths := false,
3737
// Since sbt-0.13.2
3838
incOptions := incOptions.value.withNameHashing(true),
39+
//resolvers += Resolver.mavenLocal,
3940
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-target:jvm-1.6", "-feature"),
4041
pomExtra := {
4142
<url>http://msgpack.org/</url>
@@ -92,7 +93,7 @@ object Build extends Build {
9293
"org.scalatest" % "scalatest_2.10" % "2.1.0-RC2" % "test",
9394
"org.scalacheck" % "scalacheck_2.10" % "1.11.3" % "test",
9495
"org.xerial" % "xerial-core" % "3.2.3" % "test",
95-
"org.msgpack" % "msgpack-java" % "0.6.9" % "test"
96+
"org.msgpack" % "msgpack" % "0.6.9" % "test"
9697
)
9798
}
9899

@@ -104,4 +105,4 @@ object Build extends Build {
104105

105106

106107

107-
108+

project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.7.1")
33

44
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.0")
55

6+
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

0 commit comments

Comments
 (0)