A fairly new feature of some C compilers is the "computed goto", which is around 20% faster than a traditional switch-statement.
http://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables/
That's a great description, with examples, benchmarks, and an explanation of why it's faster. I'm recording that link here because I often forget the *name* of this thing. If you don't know what you're looking for, it's hard to find.
Sunday, March 31, 2013
Netty3 Tutorial
The main Netty author (normanmauer@) tweets, "Best #netty 3.x tutorial I saw so far out there."
- http://seeallhearall.blogspot.de/2012/05/netty-tutorial-part-1-introduction-to.html
- http://seeallhearall.blogspot.de/2012/06/netty-tutorial-part-15-on-channel.html
Saturday, March 23, 2013
JarJar Links
- http://priyanka-tyagi.blogspot.com/2013/03/dealing-with-java-hell-using-jarjar.html
- https://code.google.com/p/jarjar/
In a nutshell, if you distribute Java libraries to others, (and if you do not work at Google), you cannot expect them to use the same versions of sub-libraries as you do. Hiding those sub-libraries in their own namespace is one way to solve the problem, at the cost of some memory and disk space.
Here is what JarJar does: It uses ASM to walk through .class files, changing their Java package namespace according to a pattern that you supply.
The hard part is to change all the self-references as well. ASM-3 used to have problems with Java generics, so this was only a partial solution to dependency hell. But JarJar uses ASM-4. In fact, it embeds its own copy of ASM-4 so you don't need to worry about finding a compatible version. (ASM-4 works fine with JDK-7.)
You could fairly say that JarJar uses ASM to JarJar ASM into JarJar! Here's how (inside JarJar's own Antfile):
<target name="jar"
depends="compile" description="Create Jar">
<mkdir
dir="dist"/>
<jarjar jarfile="${jarfile}">
<fileset dir="build/main"/>
<zipfileset src="lib/asm-4.0.jar"/>
<zipfileset src="lib/asm-commons-4.0.jar">
<include name="org/objectweb/asm/commons/Remap*.class"/>
<include
name="org/objectweb/asm/commons/LocalVariablesSorter.class"/>
</zipfileset>
<keep pattern="com.tonicsystems.jarjar.JarJarTask"/>
<rule
pattern="com.tonicsystems.jarjar.util.**" result="com.tonicsystems.jarjar.ext_util.@1"/>
<rule pattern="org.objectweb.asm.**" result="com.tonicsystems.jarjar.asm.@1"/>
<manifest>
<attribute name="Main-Class"
value="com.tonicsystems.jarjar.Main"/>
<attribute name="Implementation-Version"
value="${version}"/>
</manifest>
</jarjar>
</target>
Subscribe to:
Posts (Atom)