Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

PROgrm_JARvis JarvisCraft

🏠
Working from home
View GitHub Profile
View TextModelVsReplaceBenchmark.java
package ru.progrm_jarvis.benchmark.ultimatemessenger;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import ru.progrm_jarvis.ultimatemessenger.format.model.AsmGeneratingTextModelFactory;
import ru.progrm_jarvis.ultimatemessenger.format.model.TextModel;
import ru.progrm_jarvis.ultimatemessenger.format.model.TextModelFactory;
@JarvisCraft
JarvisCraft / LinesWithPlaceholders.txt
Last active Aug 8, 2019
ultimate-messenger Placeholders benchmark
View LinesWithPlaceholders.txt
Hello world
Hello, {user:name}
Hello, {user:name}, how are you?
Hello, {user:name}, how are you?
Hi, {user:name} your ping is {user:ping}
Hi, dear {user:name}, btw, {user:name}, how are you feeling? Also, what are you doing?
Your ping is {user:ping}.
Speaking about your friends, {user:friends}, how are they feeling?
Do your friends ({user:friends}) feel like they want to test your ping ({user:ping}?
This {user:magic could have been a great placeholder, but it isn't, lol
View AsmTextModelFactory$TextModelBuilder$$Generated$$TextModel$$1.java
package ru.progrm_jarvis.ultimatemessenger.format.model;
import ru.progrm_jarvis.ultimatemessenger.format.model.TextModel;
import ru.progrm_jarvis.ultimatemessenger.format.model.AsmTextModelFactory.TextModelBuilder;
public final class AsmTextModelFactory$TextModelBuilder$$Generated$$TextModel$$1 implements TextModel {
public static final TextModel D0 = TextModelBuilder.internal$getDynamicTextModel("1");
public static final TextModel D1 = TextModelBuilder.internal$getDynamicTextModel("2");
public static final TextModel D2 = TextModelBuilder.internal$getDynamicTextModel("3");
public static final TextModel D3 = TextModelBuilder.internal$getDynamicTextModel("4");
@JarvisCraft
JarvisCraft / hg.diff
Created Sep 9, 2019
[OpenJDK] [PATCH] Allow LambdaMetaFactory generate direct field access instructions
View hg.diff
diff --git a/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java b/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
--- a/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
+++ b/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
@@ -61,6 +61,7 @@
final MethodHandleInfo implInfo; // Info about the implementation method handle "MethodHandleInfo[5 CC.impl(int)String]"
final int implKind; // Invocation kind for implementation "5"=invokevirtual
final boolean implIsInstanceMethod; // Is the implementation an instance method "true"
+ final boolean implIsMethodNotField; // "true" for method and "false" for field
final Class<?> implClass; // Class for referencing the implementation method "class CC"
final MethodType instantiatedMethodType; // Instantiated erased functional interface method ty
View main.cpp
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#ifndef in
#define in std::cin
@JarvisCraft
JarvisCraft / indy-based-switch.patch
Created Nov 4, 2019
indy-based string-switch proposal
View indy-based-switch.patch
diff -r 5573a7098439 src/java.base/share/classes/java/lang/invoke/SwitchTableFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/SwitchTableFactory.java Mon Nov 04 18:07:43 2019 +0300
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
@JarvisCraft
JarvisCraft / indy-based-switch.patch
Last active Nov 4, 2019
[OpenJDK] invokedynamic-based String-switch + base for future indy-based switch implementations
View indy-based-switch.patch
diff -r 5573a7098439 src/java.base/share/classes/java/lang/invoke/SwitchTableFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/SwitchTableFactory.java Mon Nov 04 18:07:43 2019 +0300
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
@JarvisCraft
JarvisCraft / Main.java
Created Nov 21, 2019
Java this and wut
View Main.java
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.foo();
main.bar();
@JarvisCraft
JarvisCraft / StaticPlaceholderBenchmark.java
Created Feb 12, 2020
Static Placeholder Benchmark [padla:ultimate-messenger]
View StaticPlaceholderBenchmark.java
package ru.progrm_jarvis.ultimatemessenger;
import lombok.NonNull;
import lombok.val;
import lombok.var;
import org.jetbrains.annotations.Nullable;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
View BinVectorSphere.java
import java.util.BitSet;
import java.util.Objects;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.Stream;
import static java.lang.System.out;
public class BinVectorSphere {
public static void main(String[] args) {