Skip to content

Instantly share code, notes, and snippets.

View Kronuz's full-sized avatar

Germán Méndez Bravo Kronuz

View GitHub Profile
@Kronuz
Kronuz / allocators.h
Created May 28, 2019 20:43
Benchmarking map for Xapian
/*
* Copyright (c) 2015-2019 Dubalu LLC
* Copyright (c) 2017 moya-lang.org
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
@Kronuz
Kronuz / xapian-core-documentinternal_maps_buffered.diff
Created May 16, 2019 00:28
Xapian core Document::Internal buffered terms map
diff --git a/src/xapian/backends/documentinternal.cc b/src/xapian/backends/documentinternal.cc
index 7c87292fc..a20fda9a4 100644
--- a/src/xapian/backends/documentinternal.cc
+++ b/src/xapian/backends/documentinternal.cc
@@ -38,13 +38,16 @@ namespace Xapian {
void
Document::Internal::ensure_terms_fetched() const
{
- if (terms)
+ if (terms || terms_buffer)
@Kronuz
Kronuz / xapian-core-documentinternal_maps_allocator.diff
Created May 16, 2019 00:24
Xapian core Document::Internal allocator for maps
diff --git a/src/xapian/backends/documentinternal.cc b/src/xapian/backends/documentinternal.cc
index ae6b9bb6c..7c87292fc 100644
--- a/src/xapian/backends/documentinternal.cc
+++ b/src/xapian/backends/documentinternal.cc
@@ -41,7 +41,7 @@ Document::Internal::ensure_terms_fetched() const
if (terms)
return;
- terms.reset(new map<string, TermInfo>());
+ terms.reset(new terms_type());
@Kronuz
Kronuz / memory_pool_allocator.hh
Last active May 15, 2019 20:11
Memory Pool C++ Allocator
#pragma once
#include <cstddef> // for std::size_t
#include <deque> // for std::deque
#include <new> // for std::bad_alloc, std::nothrow_t, std::new_handler
namespace allocator {
constexpr std::size_t alignment = alignof(std::max_align_t);
template <typename _Tp>
@Kronuz
Kronuz / C++.sublime-syntax
Created February 8, 2019 21:26
C++ syntax for Sublime Text with fmt formatting support in the strings
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: C++ (fmt)
comment: I don't think anyone uses .hp. .cp tends to be paired with .h. (I could be wrong. :) -- chris
file_extensions:
- cpp
- cc
- cp
- cxx
module.exports = "Exported";
@Kronuz
Kronuz / cloudSettings
Last active April 1, 2020 17:40
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-04-01T17:40:03.318Z","extensionVersion":"v3.4.3"}
@Kronuz
Kronuz / profile
Created April 5, 2018 14:32
profile
#!/bin/sh
################################################################################
dubalu() {
if [ -z "$DUBALU_LEGEND" -o -n "$1" ]; then
if [ -t 1 -o "$1" = "color" ]; then
printf '\n'
printf ' \033[1;38;2;189;74;10m8888\033[0m \033[1;38;2;200;200;200m8888\033[0m \033[1;38;2;200;200;200m8888\033[0m \033[1;38;2;200;200;200m888\033[0m\n'
printf ' \033[1;38;2;189;74;10m8888888\033[0m \033[1;38;2;200;200;200m8888\033[0m \033[1;38;2;200;200;200m8888\033[0m \033[1;38;2;200;200;200m888\033[0m\n'
printf ' \033[1;38;2;189;74;10m888888K\033[0m \033[1;38;2;200;200;200m8888\033[0m \033[1;38;2;200;200;200m8888\033[0m \033[1;38;2;200;200;200m888\033[0m\n'
printf ' \033[1;38;2;189;74;10m8888888o.\033[0m \033[1;38;2;200;200;200mo8888888\033[0m \033[1;38;2;200;200;200m888\033[0m \033[1;38;2;200;200;200m888\033[0m \033[1;38;2;200;200;200m8888888o\033[0
@Kronuz
Kronuz / compiler.sh
Last active April 4, 2018 18:12
Compiler selector for macOS
compiler() {
# After installing compilers in macOS:
# brew install gcc [email protected] gcc@5 gcc@6 [email protected] llvm@4 llvm@5
# Use compiler <compiler> to select it. Ex.:
# compiler llvm@5
compiler=$1
if [ -z "$compiler" ]; then
if [ -z "$COMPILER" ]; then
@Kronuz
Kronuz / gtest.rb
Last active June 4, 2020 02:22
Homebrew Formula for Google Test
# Homebrew Formula for Google Test
# Usage: brew install --HEAD https://gist.githubusercontent.com/Kronuz/96ac10fbd8472eb1e7566d740c4034f8/raw/gtest.rb
require 'formula'
class Gtest < Formula
desc "Google Test"
homepage "https://github.com/google/googletest"
head "git://github.com/google/googletest.git", :using => :git