Skip to content

Instantly share code, notes, and snippets.

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ExpressionParser {
private static final boolean DEBUG = false;
@Deamon5550
Deamon5550 / LLFS.cpp
Created July 29, 2016 21:18
My own filesystem
#include "LLFS.h"
#include <iostream>
#define BLOCK_SIZE 512
#define BLOCK_COUNT 4096
namespace Filesystem {
@Deamon5550
Deamon5550 / Summary.md
Last active August 14, 2016 17:15
Sponge Event Benchmarking

All Tests were performed with 20 warmup iterations of 10000 cycles and 40 benchmarking iterations of 50000 cycles. Times are all in milliseconds.

These arguments were choosen such that the GC pauses would be long, but infrequent. VM arguments: -verbose:gc -Xbatch -XX:CICompilerCount=1 -XX:-TieredCompilation -Xmx10G -Xms10G -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:InitiatingHeapOccupancyPercent=80

Guava:

[16:23:56] [Server thread/INFO] [benchmarks]: Starting event system benchmarks
[16:23:56] [Server thread/INFO] [benchmarks]: Running 20 warmup iterations of 5000 cycles each
203407 1955 % b org.spongepowered.benchmark.BenchmarkPlugin::run_benchmarks @ 69 (622 bytes)
[16:23:56] [Server thread/INFO] [benchmarks]: Warmup cycles took 370.37885ms
[16:23:56] [Server thread/INFO] [benchmarks]: ================================================================================
[16:23:56] [Server thread/INFO] [benchmarks]: Running 50 benchmarking iterations of 500000 cycles each
[GC (Allocation Failure) 328017K->166033K(485376K), 0.0038773 secs]
[16:23:57] [Server thread/INFO] [benchmarks]: Iteration 0: 710.6326ms
[16:23:57] [Server thread/INFO] [benchmarks]: Iteration 1: 654.4604ms
[GC (Allocation Failure) 334481K->166033K(488448K), 0.0048701 secs]
@Deamon5550
Deamon5550 / BenchmarkPlugin.java
Created July 25, 2016 22:47
Sponge event benchmarks
package org.spongepowered.benchmark;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.spongepowered.api.GameState;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.SpongeEventFactory;
diff --git a/src/main/java/org/spongepowered/common/event/ListenerChecker.java b/src/main/java/org/spongepowered/common/event/ListenerChecker.java
index c5cd151..01a073c 100644
--- a/src/main/java/org/spongepowered/common/event/ListenerChecker.java
+++ b/src/main/java/org/spongepowered/common/event/ListenerChecker.java
@@ -42,9 +42,10 @@
public class ListenerChecker {
+ private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("sponge.debugShouldFire", "").toLowerCase());
+
import com.google.common.collect.Queues;
import java.util.Deque;
import java.util.regex.Pattern;
public class PostfixParser {
private static final Pattern variable_name = Pattern.compile("[a-zA-Z][a-zA-Z0-9_]*");
public static String convertToPostfix(String exp) {
@Deamon5550
Deamon5550 / EventFactory.java
Created July 6, 2016 19:35
Alternate event factory
/**
* A factory for generating events at runtime based on interfaces.
*/
public interface EventFactory {
/**
* Creates a new event instance of the given event type, generating an
* implementation class if needed. The arguments are specified in
* alphabetical ordering.
*
@Deamon5550
Deamon5550 / SchematicReader.java
Last active May 8, 2019 20:28
Schematic format analysis
package com.thevoxelbox.stats;
import com.thevoxelbox.stats.StatsGatherer.Schematic;
import org.jnbt.ByteArrayTag;
import org.jnbt.CompoundTag;
import org.jnbt.NBTInputStream;
import org.jnbt.ShortTag;
import org.jnbt.Tag;
import java.io.File;
@Deamon5550
Deamon5550 / schematic.md
Last active March 15, 2016 00:36
Draft specification for the Sponge Schematic Format

Sponge Schematic Specification

Version 1

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Introduction

This specification defines a format which describes a region of a Minecraft world for the purpose of serialization and storage of the region to disk. It is designed in order to allow maximum cross-compatibility between platforms, versions, and various states of modding.