Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MapValue#equals too slow #165

Copy link
Copy link
@xuwei-k

Description

@xuwei-k
Issue body actions

version 0.7.0-p2

import org.msgpack.value._

object Main {

  def mapValueEqualsTime(size: Int): Unit = {
    val keyValues: Array[Value] = (1 to size).flatMap{ key =>
      Seq(ValueFactory.newString(key.toString), ValueFactory.nilValue())
    }.toArray
    val map1, map2 = ValueFactory.newMap(keyValues)
    println(size)
    System.gc
    val start = System.nanoTime
    map1 == map2
    println((System.nanoTime - start) / 1000000.0)
    println
  }

  def main(args: Array[String]) {
    mapValueEqualsTime(10)
    mapValueEqualsTime(100)
    mapValueEqualsTime(1000)
    mapValueEqualsTime(10000)
    mapValueEqualsTime(100000)
  }

}

result

10
1.634357

100
4.078424

1000
10.137222

10000
183.871329

100000
22959.867596

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.