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
{ | |
"metadata": { | |
"name": "HistogramFail" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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::collections::TreeMap; | |
use std::collections::tree_map::Entries; // This took forever | |
use std::num::One; | |
use std::num::Saturating; | |
// Equivalent to Set<T>, but only works for Ints, and may be more efficient | |
// if the set contains large contiguous ranges. Each range is stored as a | |
// single entry instead of storing each member individually. | |
struct IntSet<T> { | |
// These correspond to ranges of high->low. The ranges are closed (inclusive) |
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
#!/usr/bin/python | |
import sys | |
import re | |
INCLUDE_RE = re.compile('^#include "([^"]*)"$') | |
def parse_include(line): | |
match = INCLUDE_RE.match(line) | |
return match.groups()[0] if match else None |
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 <stdio.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
int main(int argc, char *argv[]) { | |
// Machine code for: | |
// mov eax, 0 | |
// ret | |
unsigned char code[] = {0xb8, 0x00, 0x00, 0x00, 0x00, 0xc3}; |
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
// Output on my system: | |
// virtual call time: 4.340 | |
// non-virtual call time: 3.970 | |
// virtual call overhead 9.32% | |
#include <stdlib.h> | |
#include <time.h> | |
#include <stdio.h> | |
#define NOINLINE __attribute__ ((noinline)) |
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
// On my system: | |
// virtual call time: 4.340 | |
// non-virtual call time: 3.970 | |
// virtual call overhead 9.32% | |
#include <stdlib.h> | |
#include <time.h> | |
#include <stdio.h> | |
#define NOINLINE __attribute__ ((noinline)) |
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
// Fake upb: a fake implementation for a small subset of the | |
// actual upb interface, for testing with Rust. | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct { | |
uint32_t refcount; |
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
// Prototype for a scheme for upb Rust wrappers for upb. | |
// | |
// Output (when linked with fakeupb.c): | |
// C: new() | |
// C: number() = 1 | |
// Number: 1 | |
// C: setnumber(5) | |
// C: number() = 5 | |
// Number: 5 | |
// C: freeze() = 1 |
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
0.7% 0.7% 8645 google::protobuf::TextFormat::Parser::ParserImpl::ConsumeField(google::protobuf::Message*) | |
0.6% 1.2% 7131 google::protobuf::io::Printer::Print(char const*, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&) | |
0.5% 1.8% 6346 google::protobuf::DescriptorBuilder::BuildMessage(google::protobuf::DescriptorProto const&, google::protobuf::Descriptor const*, google::protobuf::Descriptor*) | |
0.5% 2.2% 6248 google::protobuf::io::Printer::Print(char const*, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&, char const*, std::string const&) | |
0.5% 2.7% 5974 google::protobuf::util::converter::ProtoWriter::RenderPrimitiveField |
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
autocmd FileType bzl AutoFormatBuffer buildifier | |
syntax on | |
let mapleader = "," | |
set wildmode=list:longest | |
set list | |
set listchars=tab:>-,trail:-,extends:>,precedes:<,nbsp:+ | |
set sts=2 | |
set sw=2 | |
set bs=2 |
OlderNewer