Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid BoxesRunTime #37

Open
fabianhjr opened this issue Jan 11, 2024 · 0 comments
Open

Avoid BoxesRunTime #37

fabianhjr opened this issue Jan 11, 2024 · 0 comments

Comments

@fabianhjr
Copy link
Member

Profiling shows biggest overhead currently is BoxesRunTime

This is being generated on FnBijections

   package dev.librecybernetics.data.alphabet;

import dev.librecybernetics.data.FnBijection;
import dev.librecybernetics.data.Bijection.;
import java.io.Serializable;
import java.lang.invoke.SerializedLambda;
import scala.MatchError;
import scala.runtime.BoxesRunTime;
import scala.runtime.ModuleSerializationProxy;

public final class RFC4648$ implements Serializable {
   public static final RFC4648$ MODULE$ = new RFC4648$();

   private RFC4648$() {
   }

   private Object writeReplace() {
      return new ModuleSerializationProxy(RFC4648$.class);
   }

   public FnBijection<Object, Object> base16Lowercase() {
      return .MODULE$.apply((x$1) -> {
         return base16Lowercase$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base16Lowercase$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   public FnBijection<Object, Object> base16Uppercase() {
      return .MODULE$.apply((x$1) -> {
         return base16Uppercase$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base16Uppercase$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   public FnBijection<Object, Object> base32HexLowercase() {
      return .MODULE$.apply((x$1) -> {
         return base32HexLowercase$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base32HexLowercase$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   public FnBijection<Object, Object> base32HexUppercase() {
      return .MODULE$.apply((x$1) -> {
         return base32HexUppercase$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base32HexUppercase$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   public FnBijection<Object, Object> base32Lowercase() {
      return .MODULE$.apply((x$1) -> {
         return base32Lowercase$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base32Lowercase$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   public FnBijection<Object, Object> base32Uppercase() {
      return .MODULE$.apply((x$1) -> {
         return base32Uppercase$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base32Uppercase$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   public FnBijection<Object, Object> base64() {
      return .MODULE$.apply((x$1) -> {
         return base64$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base64$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   public FnBijection<Object, Object> base64URLSafe() {
      return .MODULE$.apply((x$1) -> {
         return base64URLSafe$$anonfun$1(BoxesRunTime.unboxToByte(x$1));
      }, (x$1) -> {
         return base64URLSafe$$anonfun$2(BoxesRunTime.unboxToChar(x$1));
      });
   }

   // $FF: synthetic method
   private static final char base16Lowercase$$anonfun$1(final byte x$1) {
      if (0 <= x$1 && x$1 <= 9) {
         return (char)(x$1 + 48);
      } else if (10 <= x$1 && x$1 <= 15) {
         return (char)(x$1 + 87);
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base16Lowercase$$anonfun$2(final char x$1) {
      if ('0' <= x$1 && x$1 <= '9') {
         return (byte)(x$1 - 48);
      } else if ('a' <= x$1 && x$1 <= 'f') {
         return (byte)(x$1 - 87);
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static final char base16Uppercase$$anonfun$1(final byte x$1) {
      if (0 <= x$1 && x$1 <= 9) {
         return (char)(x$1 + 48);
      } else if (10 <= x$1 && x$1 <= 15) {
         return (char)(x$1 + 55);
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base16Uppercase$$anonfun$2(final char x$1) {
      if ('0' <= x$1 && x$1 <= '9') {
         return (byte)(x$1 - 48);
      } else if ('A' <= x$1 && x$1 <= 'F') {
         return (byte)(x$1 - 55);
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static final char base32HexLowercase$$anonfun$1(final byte x$1) {
      if (10 <= x$1 && x$1 <= 31) {
         return (char)(x$1 + 87);
      } else if (0 <= x$1 && x$1 <= 9) {
         return (char)(x$1 + 48);
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base32HexLowercase$$anonfun$2(final char x$1) {
      if ('a' <= x$1 && x$1 <= 'v') {
         return (byte)(x$1 - 87);
      } else if ('0' <= x$1 && x$1 <= '9') {
         return (byte)(x$1 - 48);
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static final char base32HexUppercase$$anonfun$1(final byte x$1) {
      if (10 <= x$1 && x$1 <= 31) {
         return (char)(x$1 + 55);
      } else if (0 <= x$1 && x$1 <= 9) {
         return (char)(x$1 + 48);
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base32HexUppercase$$anonfun$2(final char x$1) {
      if ('A' <= x$1 && x$1 <= 'V') {
         return (byte)(x$1 - 55);
      } else if ('0' <= x$1 && x$1 <= '9') {
         return (byte)(x$1 - 48);
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static final char base32Lowercase$$anonfun$1(final byte x$1) {
      if (0 <= x$1 && x$1 <= 25) {
         return (char)(x$1 + 97);
      } else if (26 <= x$1 && x$1 <= 31) {
         return (char)(x$1 + 24);
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base32Lowercase$$anonfun$2(final char x$1) {
      if ('a' <= x$1 && x$1 <= 'z') {
         return (byte)(x$1 - 97);
      } else if ('2' <= x$1 && x$1 <= '7') {
         return (byte)(x$1 - 24);
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static final char base32Uppercase$$anonfun$1(final byte x$1) {
      if (0 <= x$1 && x$1 <= 25) {
         return (char)(x$1 + 65);
      } else if (26 <= x$1 && x$1 <= 31) {
         return (char)(x$1 + 24);
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base32Uppercase$$anonfun$2(final char x$1) {
      if ('A' <= x$1 && x$1 <= 'Z') {
         return (byte)(x$1 - 65);
      } else if ('2' <= x$1 && x$1 <= '7') {
         return (byte)(x$1 - 24);
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static final char base64$$anonfun$1(final byte x$1) {
      if (0 <= x$1 && x$1 <= 25) {
         return (char)(x$1 + 65);
      } else if (26 <= x$1 && x$1 <= 51) {
         return (char)(x$1 + 71);
      } else if (52 <= x$1 && x$1 <= 61) {
         return (char)(x$1 - 4);
      } else if (62 == x$1) {
         return '+';
      } else if (63 == x$1) {
         return '/';
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base64$$anonfun$2(final char x$1) {
      if ('A' <= x$1 && x$1 <= 'Z') {
         return (byte)(x$1 - 65);
      } else if ('a' <= x$1 && x$1 <= 'z') {
         return (byte)(x$1 - 71);
      } else if ('0' <= x$1 && x$1 <= '9') {
         return (byte)(x$1 + 4);
      } else if ('+' == x$1) {
         return 62;
      } else if ('/' == x$1) {
         return 63;
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static final char base64URLSafe$$anonfun$1(final byte x$1) {
      if (0 <= x$1 && x$1 <= 25) {
         return (char)(x$1 + 65);
      } else if (26 <= x$1 && x$1 <= 51) {
         return (char)(x$1 + 71);
      } else if (52 <= x$1 && x$1 <= 61) {
         return (char)(x$1 - 4);
      } else if (62 == x$1) {
         return '-';
      } else if (63 == x$1) {
         return '_';
      } else {
         throw new MatchError(BoxesRunTime.boxToByte(x$1));
      }
   }

   // $FF: synthetic method
   private static final byte base64URLSafe$$anonfun$2(final char x$1) {
      if ('A' <= x$1 && x$1 <= 'Z') {
         return (byte)(x$1 - 65);
      } else if ('a' <= x$1 && x$1 <= 'z') {
         return (byte)(x$1 - 71);
      } else if ('0' <= x$1 && x$1 <= '9') {
         return (byte)(x$1 + 4);
      } else if ('-' == x$1) {
         return 62;
      } else if ('_' == x$1) {
         return 63;
      } else {
         throw new MatchError(BoxesRunTime.boxToCharacter(x$1));
      }
   }

   // $FF: synthetic method
   private static Object $deserializeLambda$(SerializedLambda var0) {
      return Class.lambdaDeserialize<invokedynamic>(var0);
   }
}

From: https://www.decompiler.com/jar/b5d7d2b262084241859b4dfca805802c/RFC4648%24.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant