This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::hint::black_box; | |
use std::time::Instant; | |
const ARRAY_NDIMS_LIMIT: usize = 32; | |
// Simple linear congruential generator for reproducible random numbers | |
struct SimpleRng { | |
state: u64, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"math/rand" | |
"strconv" | |
"strings" | |
"time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"log" | |
"strconv" | |
"time" | |
qdb "github.com/questdb/go-questdb-client" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
int[] arr = new int[]{1, 2, 3}; | |
for (int i = 0, n = arr.length; i < n; i++) { | |
System.out.println(arr[i]); | |
} | |
for (int n : arr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go version | |
go version go1.19.3 linux/arm64 | |
$ go test -run='^$' -cpu=1,2,4,8,16,32,64 -bench . -count=30 -timeout=0 | tee bench.txt | |
$ benchstat bench.txt | tee benchstat.txt | |
name time/op | |
Counter 27.3ns ± 1% | |
Counter-2 27.2ns ±11% | |
Counter-4 15.3ns ± 8% | |
Counter-8 7.43ns ± 7% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const keys = [ | |
'TCN', | |
'alternate-protocol', | |
':', | |
'@@', | |
'中文呢', | |
'((((())))', | |
':alternate-protocol', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface MetricsStorage { | |
store(dataPoints: DataPoint[]): Promise<void>; | |
queryRange(query: Query): Promise<DataPoint[]>; | |
queryLatest(query: Query): Promise<DataPoint | null>; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface DataPoint { | |
metric: string; | |
tags: Map<string, string>; | |
time: number; | |
value: number; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const crypto = require('crypto'); | |
const net = require('net'); | |
const writeCount = 10000000; | |
const batchSize = 100; | |
const chunkSize = 128; | |
const chunks = []; | |
const state = { writes: 0 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const { AsyncLocalStorage } = require('async_hooks'); | |
const asyncLocalStorage = new AsyncLocalStorage(); | |
function print(msg) { | |
const id = asyncLocalStorage.getStore(); | |
console.log(`${id !== undefined ? id : '-'}:`, msg); | |
} |
NewerOlder