<commit_before>
import java.nio.ByteBuffer
import scala.collection.immutable.Vector
import scala.collection.mutable.ListBuffer
import scala.util.Random

import com.esotericsoftware.kryo._
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.{Serializer => KSerializer}
import com.esotericsoftware.kryo.io.{Input, Output}

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport

import scala.collection.mutable.Builder

import org.evactor.model.events.DataEvent
import scala.util.Random

class KryoSerializer {
  val kryo = new KryoReflectionFactorySupport
    //new Kryo

  // registering some basic types to try to serialize
  val toRegister = Seq(Array(1.0), Array(1), (1, 1), Some(1), Array(new Object)/*, 1 :: Nil*/)
  for (obj <- toRegister) kryo.register(obj.getClass)

  // kryo.addDefaultSerializer(mf.erasure, new TraversableSerializer(List.newBuilder[Any]))

  // serialize
  def toBytes[T](obj: T, buffer: Array[Byte]): Array[Byte] = {
    val op = new Output(buffer, Int.MaxValue)
    kryo.writeClassAndObject(op, obj)
    op.flush()
    val bytes = op.toBytes()
    op.close()
    bytes
  }

  // deserialize
  def fromBytes[T](arr: Array[Byte]): T = {
    val ip = new Input(arr)<commit_msg>Fix benchmark build, just needed an import<commit_after>
import java.nio.ByteBuffer
import scala.collection.immutable.Vector
import scala.collection.mutable.ListBuffer
import scala.util.Random

import com.esotericsoftware.kryo._
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.{Serializer => KSerializer}
import com.esotericsoftware.kryo.io.{Input, Output}

import de.javakaffee.kryoserializers.KryoReflectionFactorySupport

import scala.collection.mutable.Builder

import org.evactor.model.events.DataEvent
import scala.util.Random

import scala.pickling.testing

class KryoSerializer {
  val kryo = new KryoReflectionFactorySupport
    //new Kryo

  // registering some basic types to try to serialize
  val toRegister = Seq(Array(1.0), Array(1), (1, 1), Some(1), Array(new Object)/*, 1 :: Nil*/)
  for (obj <- toRegister) kryo.register(obj.getClass)

  // kryo.addDefaultSerializer(mf.erasure, new TraversableSerializer(List.newBuilder[Any]))

  // serialize
  def toBytes[T](obj: T, buffer: Array[Byte]): Array[Byte] = {
    val op = new Output(buffer, Int.MaxValue)
    kryo.writeClassAndObject(op, obj)
    op.flush()
    val bytes = op.toBytes()
    op.close()
    bytes
  }

  // deserialize
  def fromBytes[T](arr: Array[Byte]): T = {
    val ip = new Input(arr)
{'fraction_non_alphanumeric': 0.11827531645569621, 'fraction_numerical': 0.005537974683544304, 'mean_word_length': 4.427038626609442, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3275350', 'n_tokens_mistral': 885, 'n_tokens_neox': 858, 'n_words': 187}