- Client sends all requests without waiting for the server responses.
- This saves at least one roundtrip since the server no longer needs to wait for the client to receive the response in order to get the next request.
- Client does less OS calls to send the requests, as it can concatenate them.
- Server can process all requests at the same time, saving total latency time for all requests and responses combined.
- Even if the server does not support pipelining, the client sending all requests combined still saves up to N half-roundtrips. Where N is the number of requests.
This file contains 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
import os | |
import std/[times, monotimes, stats] | |
from regex import nil | |
from std/re import nil | |
proc measureNimRegex(data, pattern: string) = | |
var r: RunningStat | |
var matches: int | |
let patternRe = regex.re(pattern) | |
for i in 1..3: |
This file contains 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
from strutils import find | |
from unicode import Rune | |
# XXX do a simpler find when vm (or no memchr available), | |
# since this is only fast due to memchr | |
# untested | |
func find*(s: string, r: Rune, start: Natural = 0): int = | |
if r.ord < 0xff: | |
return find(s, r.char, start) | |
let c = (r.ord and 0xff).char |
This file contains 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
import deque | |
def _e_closure(node: Node, result: Set[Node]) -> None: | |
if isinstance(Node, (CharNode, EOFNode)): # si es matcheable | |
result.add(node) | |
return | |
# node deberia ser *, +, |, (, ) | |
for n in node.out: | |
_e_closure(n, result) |
This file contains 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
import nimbench | |
import unicodedb/properties | |
import unicodedb/types | |
import unicodedb/widths | |
import unicodedb/scripts | |
import unicodedb/decompositions | |
import unicode | |
template benchCode( | |
theProc: untyped, |
This file contains 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
/* | |
ERROR in ./node_modules/moment-timezone/data/packed/latest.json | |
Module parse failed: Unexpected token e in JSON at position 0 while parsing near 'export default { | |
Module build failed (from ./node_modules/babel-loader/lib/index.js): | |
SyntaxError: /usr/src/app/ui/src/tz: Unexpected token, expected ";" (1:10) | |
Here is a solution: | |
*/ |
This file contains 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> | |
<meta charset="utf-8"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} |
This file contains 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
def serialize_datetime(dt): | |
return ( | |
dt.astimezone(timezone.get_default_timezone()) | |
.isoformat() | |
.replace('+00:00', 'Z')) |
This file contains 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
proc split*(s: string, sep: Regex): seq[string] = | |
result = @[] | |
var | |
m = RegexMatch() | |
ds = initDataSets(sep.states.len, true) | |
first = 0 | |
last = 0 | |
n = 0 | |
while last <= s.len: | |
first = last |
This file contains 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
# from https://github.com/systemd/systemd/blob/b0450864f1723ad12176d7956377d89ff4a84d8c/src/basic/unit-def.c | |
"stub", | |
"loaded", | |
"not-found", | |
"bad-setting", | |
"error", | |
"merged", | |
"masked" |
NewerOlder