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
// > file-sync-blocking.test.mjs | |
import test from 'node:test'; | |
import assert from 'node:assert'; | |
import fs from "node:fs"; | |
test('reading file 10,000 times with callback blocking', (t) => { | |
for (let i = 0; i < 10000; i++ ) { | |
const data = fs.readFileSync("./text.txt", { encoding: 'utf-8'}) | |
assert.strictEqual(data, "Hello, world") | |
} |
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
/* eslint-disable @typescript-eslint/no-unused-vars */ | |
const sizes = [1000, 100000, 1000000, 10000000, 100000000]; | |
async function run() { | |
let count = 0; | |
const counts: { | |
forOf: { | |
[key in number]: 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
#!/bin/bash | |
set -e | |
# Helper functions | |
log() { | |
echo >&2 -e "${1-}" | |
} | |
# Setup vars |
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
#! /bin/bash | |
set -e | |
# --- Globals --- | |
declare default_remote=newscred | |
declare remote | |
declare branch | |
# --- Function definitions --- |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Out test</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
class FastScanner { | |
BufferedReader br; | |
StringTokenizer st; | |
public FastScanner() { | |
br = new BufferedReader(new InputStreamReader(System.in)); | |
} | |
String next() { | |
while (st == null || !st.hasMoreElements()) { |
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
#include <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
printf("Hello World\n"); | |
return 0; | |
} |