Skip to content

Instantly share code, notes, and snippets.

View bleporini's full-sized avatar

Brice LEPORINI bleporini

  • Confluent
  • Dubai
View GitHub Profile
@bleporini
bleporini / AccountResource.java
Created March 21, 2015 07:15
JHipster no graph loader
package com.mycompany.myapp.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.mycompany.myapp.domain.Authority;
import com.mycompany.myapp.domain.PersistentToken;
import com.mycompany.myapp.domain.User;
import com.mycompany.myapp.repository.PersistentTokenRepository;
import com.mycompany.myapp.repository.UserRepository;
import com.mycompany.myapp.security.SecurityUtils;
import com.mycompany.myapp.service.MailService;
@bleporini
bleporini / XmlUnitTest.java
Created August 23, 2013 05:26
XMLUnit Demo...
package org.blep;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.Difference;
import org.custommonkey.xmlunit.DifferenceListener;
import org.junit.Test;
import org.w3c.dom.Node;
import static junit.framework.Assert.assertFalse;
import static org.custommonkey.xmlunit.XMLAssert.*;
@bleporini
bleporini / CountBugTest.scala
Created February 9, 2013 06:18
Scala Slick: Bug on count query generation
import slick.session.Database
import org.scalatest.FunSuite
// Use H2Driver to connect to an H2 database
import scala.slick.driver.H2Driver.simple._
// Use the implicit threadLocalSession
import Database.threadLocalSession

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs