Skip to content

Instantly share code, notes, and snippets.

View shyan1's full-sized avatar
🖖
Working from home

shyan shyan1

🖖
Working from home
View GitHub Profile

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

@shyan1
shyan1 / amazon.md
Created September 13, 2022 02:27 — forked from terabyte/amazon.md
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

@shyan1
shyan1 / UsingLens.scala
Created August 23, 2022 10:12
learning lens [scala]
case class Turtle(
xcor: Double,
ycor: Double,
heading: Double)
// The need of lens arises when there is too much nesting
case class User(id: UserId, generalInfo: GeneralInfo, billInfo: BillInfo)
case class UserId(value: Long)
@shyan1
shyan1 / .scalafmt.conf
Created August 17, 2022 10:11
scalafmt config file for Scala 3
version = "3.5.3"
runner.dialect = scala3
align.preset = more
newlines.alwaysBeforeElseAfterCurlyIf = false
newlines.beforeMultilineDef = keep
newlines.topLevelStatements = [before]
newlines.beforeCurlyLambdaParams = multilineWithCaseOnly
newlines.afterCurlyLambdaParams = squash
newlines.implicitParamListModifierForce = [after]
@shyan1
shyan1 / .gitconfig
Created June 4, 2022 04:40
gitconfig
$ cat .gitconfig
[http]
sslVerify = false
[url "https://hub.fastgit.xyz"]
insteadof = "https://github.com"
@shyan1
shyan1 / build.sbt
Created May 11, 2022 08:05 — forked from channingwalton/build.sbt
Scala 2.13 compiler flags
val scalacOptions ++= Seq(
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
@shyan1
shyan1 / comments.md
Created April 24, 2022 02:25 — forked from adamveld12/comments.md
Go Code Review Comments

Go Code Review Comments

This page collects common comments made during reviews of Go code, so that a single detailed explanation can be referred to by shorthands. This is a laundry list of common mistakes, not a style guide.

You can view this as a supplement to http://golang.org/doc/effective_go.html.

Please discuss changes before editing this page, even minor ones. Many people have opinions and this is not the place for edit wars.

@shyan1
shyan1 / .Cloud.md
Last active January 19, 2022 03:49 — forked from imba-tjd/.Cloud.md
☁️ 一些免费的云资源

IaaS指提供系统(可以自己选)或者储存空间之类的硬件,软件要自己手动装;PaaS提供语言环境和框架(可以自己选);SaaS只能使用开发好的软件(卖软件本身);BaaS一般类似于非关系数据库,但各家不通用,有时还有一些其它东西。

其他人的集合

@shyan1
shyan1 / .Cloud.md
Created January 19, 2022 03:48 — forked from sslav1/.Cloud.md
☁️ 一些免费的云资源

IaaS指提供系统(可以自己选)或者储存空间之类的硬件,软件要自己手动装;PaaS提供软件/框架(可以自己选);SaaS只能使用开发好的软件(卖软件本身);BaaS一般类似于非关系数据库,但各家不通用,有时还有一些其它东西。

其他人的集合