Skip to content

Instantly share code, notes, and snippets.

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@rhamedy
rhamedy / README.md
Last active June 1, 2022 02:20
Configure HikariCP with Spring Boot JPA Hibernate and PostgreSQL as a database

I came across HikariCP and I was amazed by the benchmarks and I wanted to try it instead of my default choice C3P0 and to my surprise I struggled to get the configurations right probably because the configurations differ based on what combination of tech stack you are using.

I have setup Spring Boot project with JPA, Web, Security starters (Using [Spring Initializer][1]) to use PostgreSQL as a database with HikariCP as connection pooling.
I have used Gradle as build tool and I would like to share what worked for me for the following assumptions:

  1. Spring Boot Starter JPA (Web & Security - optional)
  2. Gradle build tool
  3. PostgreSQL running and setup with a database (i.e. schema, user, db)

This gist is related to SO post https://stackoverflow.com/questions/26490967/how-do-i-configure-hikaricp-in-my-spring-boot-app-in-my-application-properties-f

@StevenACoffman
StevenACoffman / Docker Best Practices.md
Last active June 23, 2024 10:51
Docker Best Practices

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential

@spences10
spences10 / github-cheat-sheet.md
Last active March 22, 2022 17:59
GitHub Cheat Sheet

Useful Git commands

This is just stuff that I have put down that I find I use a lot of the time for my own reference.

Latest changes from repo to your machine

$ git pull
@zhengda
zhengda / gist:2b1b2ebbcaba215c059d32191a80f06c
Created December 30, 2016 07:51
近200篇機器學習&深度學習資料分享
本文約2014年前後在網路上流傳的,收集了百來篇關於機器學習和深度學習的資料,含各種文檔,視頻,源碼等。而且原文也會不定期的更新,望看到文章的朋友能夠學到更多。
88d45181jw1f07djl14e0j20av064dgg.jpg
Brief History of Machine Learning
介紹:這是一篇介紹機器學習歷史的文章,介紹很全面,從感知機、神經網路、決策樹、SVM、Adaboost 到隨機森林、DeepLearning.
http://www.datascienceassn.org/sites/default/files/users/user1/DataScienceMozer2014.pdf
Deep Learning in Neural Networks: AnOverview
介紹:這是瑞士人工智慧實驗室 JurgenSchmidhuber 寫的最新版本《神經網路與深度學習綜述》本綜述的特點是以時間排序,從 1940 年開始講起,到 60-80 年代,80-90 年代,一直講到 2000 年後及最近幾年的進展。涵蓋了 deep learning 裡各種 tricks,引用非常全面.

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@TimurFayruzov
TimurFayruzov / bootstrap.json
Created June 29, 2016 17:42
Setup for running a Flink application on EMR
[
{
"Name": "Ship Flink runtime to cluster",
"Path": "s3://<your_bucket>/flink/ship_flink_runtime.sh"
},
{
"Name": "Ship application to cluster",
"Path": "s3://<your_bucket>/flink/ship_app.sh"
}
]
@orlando
orlando / mac-setup.md
Last active May 13, 2024 17:39 — forked from todc/mac-setup.md
Fresh Mac OS Setup

1. Run Software Update

Make sure everything is up to date in the App Store

2. Install Homebrew

  1. Open a terminal window and execute the Homebrew install script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Automatically Prepend a Jira Issue ID to Git Commit Messages

Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message

Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.

  1. Create an empty commit-msg git hook file, and make it executable. From your project's root directory:

     install -b -m 755 /dev/null .git/hooks/commit-msg
    
  2. Save the following script to the newly-created .git/hooks/commit-msg file:

@hlb
hlb / Brewfile
Last active June 14, 2022 02:48 — forked from saetia/gist:1623487
Clean Install Script
cask_args appdir: '/Applications'
tap 'caskroom/cask'
tap "homebrew/cask-fonts"
tap 'caskroom/versions'
tap "homebrew/bundle"
tap "homebrew/core"
tap "homebrew/services"
tap "hsatac/toybox"
brew "coreutils"
brew "gnu-sed"