NDJSON is a convenient format for storing or streaming structured data that may be processed one record at a time.
- Each line is a valid JSON value
- Line separator is ‘\n’
cat test.json | jq -c '.[]' > testNDJSON.json
NDJSON is a convenient format for storing or streaming structured data that may be processed one record at a time.
cat test.json | jq -c '.[]' > testNDJSON.json
"use strict"; | |
var API_KEY = '__API_KEY__'; | |
var PHOTOSET_IDS = ['__ID1__', '__ID2__', '__ID3__']; | |
var cartagenaApp = angular.module('cartagenaApp'); | |
cartagenaApp.directive('flickrBackground', function(Flickr, $http) { | |
var _flickrBackground = function($scope, $element) { | |
var nextPhoto; |
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
private void test(List<ExchangeRate> exchangeRates) { | |
Map<String, ExchangeRate> rateType11Map = new HashMap<String, ExchangeRate>(); | |
Map<String, ExchangeRate> rateType12Map = new HashMap<String, ExchangeRate>(); | |
Collections.sort(exchangeRates, new Comparator<ExchangeRate>() { | |
@Override | |
public int compare(ExchangeRate e1, ExchangeRate e2) { | |
return ComparisonChain.start() | |
.compare(e1.getRateCurrency(), e2.getRateCurrency()) | |
.compare(e1.getRateType(), e2.getRateType()) |
def generateMD5(String s) { | |
MessageDigest digest = MessageDigest.getInstance("MD5") | |
digest.update(s.bytes); | |
new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0') | |
} |
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |