deno bench heap-bench.js| benchmark | time/iter (avg) | iter/s | (min … max) | p75 | p99 | p995 |
|---|---|---|---|---|---|---|
| heap | 141.4 ns | 7,070,000 | (136.0 ns … 338.0 ns) | 142.3 ns | 149.0 ns | 151.6 ns |
| redundant sort and shift | 1.6 µs | 644,800 | ( 1.5 µs … 1.6 µs) | 1.5 µs | 1.6 µs | 1.6 µs |
| import hashlib | |
| import hmac | |
| import json | |
| import struct | |
| import sys | |
| def main(): | |
| if len(sys.argv) != 2: | |
| print(f"Usage: python3 {sys.argv[0]} COURSES.jsonl\n", file=sys.stderr) |
$ python --version
Python 3.6.0
$ python -m timeit -s 'import random; l = list(range(18))' 'random.choice(l)'
1000000 loops, best of 3: 0.591 usec per loop
$ python -m timeit -s 'd = {str(n): list(range(15)) for n in range(18)}' 'd["12"]'
10000000 loops, best of 3: 0.0224 usec per loop| import itertools | |
| data = ['str', 'int', 'dex', 'con', 'wis', 'cha'] | |
| covered = frozenset([ | |
| # paladin | |
| ('wis', 'cha'), ('cha', 'str'), ('str', 'cha'), ('str', 'int'), | |
| # barbarian | |
| ('str', 'dex'), ('str', 'con'), ('con', 'str'), |
| addDataset(id: string, content: string): Promise<InsightResponse> { | |
| return new Promise(function (fulfill, reject) { | |
| let zip = new JSZip(); | |
| let courseStringsPromises: Promise<string>[] = []; | |
| if (id === "" || id === null) { | |
| reject({"code": 400, "body": {"error": "invalid id"}}); | |
| } | |
| if (content === "" || content === null) { |
| using System; | |
| using System.Collections.Generic; | |
| static class Application { | |
| static void Main() { | |
| var list = new List<int>(); | |
| for (int i = 0; i < 100; i++) { | |
| Console.WriteLine("{0,5}/{1,5}", list.Count, list.Capacity); | |
| list.Add(i); |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| // most code is single-threaded | |
| unsigned char* current_mem; | |
| void* readA(); | |
| void* readB(); |
| using System; | |
| using System.Windows.Forms; | |
| using System.Drawing; | |
| using System.Drawing.Imaging; | |
| class ColorInterpolationApplication { | |
| public static void Main() { | |
| Application.Run(new ColorInterpolation()); | |
| } | |
| } |
| alert("Don't blindly paste scripts into your console! Sheesh."); |
| #include <string.h> | |
| #include <stdio.h> | |
| #include <libpq-fe.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| #include <sys/socket.h> | |
| #include <sys/epoll.h> | |
| #include <netinet/in.h> | |
| #include <arpa/inet.h> |