Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Jurczak pauljurczak

  • USA
View GitHub Profile
View gist:159ac806766f17cb2af56090b50c84fb
162 required packages:
- ASTInterpreter 0.0.4
- AbstractTrees 0.0.4
- ArgParse 0.5.0
- Atom 0.5.10
- AutoGrad 0.0.6
- AutoHashEquals 0.1.1
- AxisAlgorithms 0.1.6
- BinDeps 0.5.0
- Blink 0.5.2
View vectorIntersectionBenchmarkLoopOpt1.cpp
int vectorIntersectionBenchmarkLoopOpt1()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<vector<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
View setIntersectionBenchmarkLoopOpt1.cpp
int setIntersectionBenchmarkLoopOpt1()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<set<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
View unorderedSetIntersectionBenchmark.cpp
template <typename InIt1, typename InIt2, typename OutIt>
OutIt unordered_set_intersection(InIt1 b1, InIt1 e1, InIt2 b2, InIt2 e2, OutIt out) {
while (!(b1 == e1)) {
if (!(std::find(b2, e2, *b1) == e2)) {
*out = *b1;
++out;
}
++b1;
}
View vectorIntersectionBenchmark.cpp
int vectorIntersectionBenchmark()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<vector<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
View setIntersectionBenchmark.cpp
int setIntersectionBenchmark()
{
const int nBags = 1000;
const int maxBagLength = 10;
vector<set<int>> bags;
ifstream input("10000ran.dat"); // http://www.agner.org/random/10000ran.zip
int similarity = 0;
bags.reserve(nBags);
View setIntersectionBenchmark.java
static int setIntersectionBenchmark() throws java.io.IOException {
final int nBags = 1000;
final int maxBagLength = 10;
Scanner scanner = new Scanner(new File("10000ran.dat"));
ArrayList<HashSet<Integer>> bags = new ArrayList<HashSet<Integer>>(nBags);
int similarity = 0;
scanner.useDelimiter(",\\s*");
@pauljurczak
pauljurczak / main.cpp
Last active Sep 10, 2015
Fractional pixel size with Qt
View main.cpp
#include <QApplication>
#include <QGraphicsScene>
#include <QLabel>
#include <QBrush>
#include <QGraphicsSimpleTextItem>
#include <QColor>
#include <QGraphicsView>
using namespace std;
You can’t perform that action at this time.