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

@purgna
purgna / pydata-nyc-2017-nba-fouls-python.ipynb
Created December 22, 2017 16:22 — forked from AustinRochford/pydata-nyc-2017-nba-fouls-python.ipynb
PyData NYC 2017 Understanding NBA Foul Calls with Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@purgna
purgna / comprehensions.md
Created March 28, 2016 09:41 — forked from bearfrieze/comprehensions.md
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

All of the tasks presented in the examples can be accomplished with the extensive standard library available in Python. These solutions would arguably be more terse and efficient in some cases. I don't have anything against the standard library. To me there is a certain

@purgna
purgna / Tutorial.md
Created February 24, 2016 15:20 — forked from iondune/Tutorial.md
How-To-Neo4j-Reasoning

Fair warning: getting to the reasoning point of this process requires an extraordinary amount of hand waving. We're about to go down the rabbit hole.

Neo4j

Foreword

An unfortunate part of this set up is that you're going to need to set up two different programs:

  1. Neo4j Server
@purgna
purgna / README.md
Created February 1, 2016 18:50 — forked from denji/README.md
Remove WebStorm; PhpStorm; PyCharm; RubyMine; AppCode; CLion, IntelliJ; 0xDBE10 settings and cli-links from Mac OSX

Quick uninstall JetBrains settings:

curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s
# coding=UTF-8
import nltk
from nltk.corpus import brown
# This is a fast and simple noun phrase extractor (based on NLTK)
# Feel free to use it, just keep a link back to this post
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/
# Create by Shlomi Babluki
# May, 2013
@purgna
purgna / cssImage.php
Last active October 13, 2015 08:04 — forked from jawb/cssImage.php
Image to CSS
<?php
/*
Demos:
https://jsbin.com/gakudi/1/edit?output
https://jsbin.com/xunifo/edit?output
Usage:
php cssImage.php scale image output
*/
@purgna
purgna / faa-333-pdf-gathering.md
Created October 3, 2015 10:51 — forked from dannguyen/faa-333-pdf-gathering.md
Using wget + grep to explore inconveniently organized federal data (FAA Section 333 Exemptions)

if !database: wget + grep

The Federal Aviation Administration is posting PDFs of the Section 333 exemptions that it grants, i.e. the exemptions for operators who want to fly drones commercially before the FAA finishes its rulemaking. A journalist wanted to look for exemptions granted to operators in a given U.S. state. But the FAA doesn't appear to have an easy-to-read data file to use and doesn't otherwise list exemptions by location of operator.

However, since their exemptions page is just one giant HTML table for listing the PDFs, we can just use wget to fetch all the PDFs, run pdftotext on each file, and then [grep](https://medium.com/@rualthanzauva/grep-was-a-private-command-of-m

@purgna
purgna / kb-uninstall.bat
Last active September 1, 2015 05:29 — forked from Citillara/kb-uninstall.bat
Windows updates to remove
:: Removes most telemetry/data collection/potentially unwanted behavior from Windows 7
:: Note : be careful to keep KB in descending order
:: Removes Windows 7-8.1 telemetry (part 1)
wusa /uninstall /kb:3080149
wusa /uninstall /kb:3075249
wusa /uninstall /kb:3068708
:: Removes the "Get Windows 10" (GWX)
wusa /uninstall /kb:3035583
:: Removes Windows 7-8.1 telemetry (part 2)
@purgna
purgna / gist:eb685be79596461fd617
Last active September 1, 2015 05:28 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents