Skip to content

Commit 5778631

Browse files
committed
More inlining for Scala.js
1 parent 0cea612 commit 5778631

File tree

1 file changed

+8
-0
lines changed
  • jsoniter-scala-core/js/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core

1 file changed

+8
-0
lines changed

jsoniter-scala-core/js/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/JsonReader.scala

+8
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ final class JsonReader private[jsoniter_scala](
546546
* @throws JsonReaderException in cases of reaching the end of input or dection of leading zero or
547547
* illegal format of JSON value or exceeding capacity of `Byte`
548548
*/
549+
@inline
549550
def readByte(): Byte = readByte(isToken = true)
550551

551552
/**
@@ -569,6 +570,7 @@ final class JsonReader private[jsoniter_scala](
569570
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
570571
* illegal format of JSON value or exceeding capacity of `Short`
571572
*/
573+
@inline
572574
def readShort(): Short = readShort(isToken = true)
573575

574576
/**
@@ -578,6 +580,7 @@ final class JsonReader private[jsoniter_scala](
578580
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
579581
* illegal format of JSON value or exceeding capacity of `Int`
580582
*/
583+
@inline
581584
def readInt(): Int = readInt(isToken = true)
582585

583586
/**
@@ -587,6 +590,7 @@ final class JsonReader private[jsoniter_scala](
587590
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
588591
* illegal format of JSON value or exceeding capacity of `Long`
589592
*/
593+
@inline
590594
def readLong(): Long = readLong(isToken = true)
591595

592596
/**
@@ -596,6 +600,7 @@ final class JsonReader private[jsoniter_scala](
596600
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
597601
* illegal format of JSON value
598602
*/
603+
@inline
599604
def readDouble(): Double = readDouble(isToken = true)
600605

601606
/**
@@ -605,6 +610,7 @@ final class JsonReader private[jsoniter_scala](
605610
* @throws JsonReaderException in cases of reaching the end of input or detection of leading zero or
606611
* illegal format of JSON value
607612
*/
613+
@inline
608614
def readFloat(): Float = readFloat(isToken = true)
609615

610616
/**
@@ -2313,6 +2319,7 @@ final class JsonReader private[jsoniter_scala](
23132319

23142320
// Based on the 'Moderate Path' algorithm from the awesome library of Alexander Huszagh: https://github.com/Alexhuszagh/rust-lexical
23152321
// Here is his inspiring post: https://www.reddit.com/r/rust/comments/a6j5j1/making_rust_float_parsing_fast_and_correct
2322+
@inline
23162323
private[this] def toDouble(m10: Long, e10: Int, from: Int, newMark: Int, pos: Int): Double =
23172324
if (m10 == 0L || e10 < -343) 0.0
23182325
else if (e10 >= 310) Double.PositiveInfinity
@@ -2457,6 +2464,7 @@ final class JsonReader private[jsoniter_scala](
24572464

24582465
// Based on the 'Moderate Path' algorithm from the awesome library of Alexander Huszagh: https://github.com/Alexhuszagh/rust-lexical
24592466
// Here is his inspiring post: https://www.reddit.com/r/rust/comments/a6j5j1/making_rust_float_parsing_fast_and_correct
2467+
@inline
24602468
private[this] def toFloat(m10: Long, e10: Int, from: Int, newMark: Int, pos: Int): Float =
24612469
if (m10 == 0L || e10 < -64) 0.0f
24622470
else if (e10 >= 39) Float.PositiveInfinity

0 commit comments

Comments
 (0)