Skip to content

Instantly share code, notes, and snippets.

@bowin
bowin / gist:7426980833dd8e98bdcee51c9b89e57b
Last active April 16, 2021 06:07
bitmap 索引 protobuf 数据结构

先用bitmap来标记哪些field存在,每个field只占1bit,按1000个field来算只需要125个字节的开销,然后存在的field记录偏移,每个偏移4个字节。还可以采用inline value的方式进一步优化空间,低于4字节的field可以将value直接记录在偏移字段,不需要额外的偏移存储。

按照现在的物料数据进行测试:===>新数据格式空间大小=>inline优化后的空间大小(inline优化比率) 从数据可以看出,能够将单条物料控制在5K大小,inline的能够平均优化5%空间,1000万物料大概50G内存。

package com.weibo.hotwb.inspect;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@38
38 / Makefile
Last active February 19, 2024 02:12
A Minimal LLVM JIT example for LLVM-5
jit-toy: jit-toy.cpp
clang++ -g -o $@ $^ $(shell /usr/lib/llvm-5.0/bin/llvm-config --cxxflags --ldflags --system-libs --libs core)
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm