Skip to content

Instantly share code, notes, and snippets.

View MysterionRise's full-sized avatar

Konstantin Perikov MysterionRise

View GitHub Profile
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
@MysterionRise
MysterionRise / iterate_perf_test.py
Last active December 6, 2021 18:22
What is the most efficient way to iterate over 2d array and maintain index for best algorithmic performance?
"""
Simple performance test of different approaches to work with 2d array:
Performance results:
Number of iterations = 100, size of 2d array = 10000
Approach Total time Per iteration
---------------------------------------------------------------
- range() + indices 11.2518s 0.1125s
- iterate + .index() 216.3334s 2.1633s
package org.mystic.amthauer;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
public class Cleanup2 {
package org.mystic.amthauer;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Scanner;
public class Cleanup1 {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(Paths.get("1.txt"));

Keybase proof

I hereby claim:

  • I am mysterionrise on github.
  • I am mysterion (https://keybase.io/mysterion) on keybase.
  • I have a public key ASDXRARuqWQZCzch8nrkDiwtGVfCEoaTK7nTMq4rJ_7dbwo

To claim this, I am signing this object:

@MysterionRise
MysterionRise / Test.scala
Created September 30, 2014 10:49
Scala for, foreach, while, tailrec comparison
import java.util._
import java.io._
import java.util
import scala.annotation.tailrec
object Test {
var out: PrintWriter = null
var br: BufferedReader = null