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
use std::thread; | |
static NEED: [u8; 21] = [43, 25, 20, 16, 15, 13, 12, 12, 11, 10, 10, 8, 8, 4, 4, 3, 3, 1, 1, 1, 1]; | |
fn is_ok<F>(pred: F) -> bool | |
where F: Fn(u8) -> u8 | |
{ | |
let mut counts = [0; 256]; | |
for tok in 0..256 { | |
counts[pred(tok as u8) as usize] += 1; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 random | |
# Make this higher when you want better graphs | |
iters = 100 | |
def trunc(x): | |
return x % (2**64) | |
def test_row(f, swaps): | |
seen = set() |
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
time: 0.594; rss: 322MB parsing | |
time: 0.000; rss: 322MB recursion limit | |
time: 0.000; rss: 322MB crate injection | |
time: 0.000; rss: 322MB plugin loading | |
time: 0.000; rss: 322MB plugin registration | |
time: 0.295; rss: 349MB expansion | |
time: 0.000; rss: 349MB maybe building test harness | |
time: 0.012; rss: 349MB maybe creating a macro crate | |
time: 0.000; rss: 349MB checking for inline asm in case the target doesn't support it | |
time: 0.023; rss: 349MB complete gated feature checking |
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 random | |
hero_hp = random.randint(500, 1000) | |
minotaur_hp = random.randint(1000, 2000) | |
damage_base = 100 | |
heal_base = 50 | |
while True: | |
print("Hero HP: {}".format(hero_hp)) |
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
#include <algorithm> | |
class X { | |
private: | |
std::size_t size; | |
int *data; | |
public: | |
// You still keep the main three, the constructor, | |
// copy constructor and destructor, |
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
#include "benchmark/benchmark.h" | |
#include <algorithm> | |
class X { | |
private: | |
std::size_t size; | |
int *data; | |
public: |
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
/** | |
* This code uses std.experimental.ndslice to take the mean of the columns in | |
* a 2d 100x1000 array and creates a benchmark of that code. | |
* | |
* My mean running time is about 1.2 ms. | |
* | |
* If we compare this code to the Numpy equivalent, | |
* | |
* import numpy | |
* data = numpy.arange(100000, dtype="int32").reshape((100, 1000)) |
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
Show hidden characters
[ | |
{ | |
"caption": "SublimeREPL: Python 3", | |
"command": "run_existing_window_command", "args": | |
{ | |
"id": "repl_python3", | |
"file": "config/Python3/Main.sublime-menu" | |
} | |
}, | |
{ |
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
#![feature(test)] | |
extern crate test; | |
use std::f64; | |
pub fn parse_builtin(string: &str) -> Option<f64> { | |
string.parse().ok() | |
} |