/images/avatar.jpg
杂七杂八的,随手记录。

Performance Tip of the Week

本文为摘录(或转载),侵删,原文为: -https://abseil.io/fast/21 -https://abseil.io/fast/9 -https://abseil.io/fast

1 #9: Optimizations past their prime

1.1 Best practices

– 可能的情况下编写清晰、惯用的代码
Prefer writing clear, idiomatic code whenever possible. It is not only easier to read and debug, but in the long run, also easier for the compiler to optimize.

Prefix Filter: Better Than Bloom

Table of Contents

本文为摘录(或转载),侵删,原文为: ../pdf/d/p1311-even.pdf

1 Abstract

2 INTRODUCTION

  • What is a filter

    属于近似查询 (approximate membership query), 用于判断独具是否在集合中。

    • 如果输入在集合中,则必定输出 Yes
    • 如果不在集合中,则输出 Yes 的概率不能多于 \(\Sigma\)
  • What are filters used for
    • 与精确查询相比
      • 更省资源, 与数据量无关,而与 Σ (误报率)有关
      • 适于放在内存中,用于真正操作之前来过滤掉无效数据
        • 比如 join

Red Hat Enterprise Linux 7 Performance Tuning Guide

本文为摘录(或转载),侵删,原文为: attachments/pdf/c/red_hat_enterprise_linux-7-performance_tuning_guide-en-us.pdf

1 TOOLS

1.1 top

1.2 ps

1.3 vmstat – Virtual Memory Statistics

1.4 sar – System Activity Repoter

1.5 perf

1.6 tubostat

1.7 iostat

1.8 irqbalance

1.9 ss – socket statistics

1.10 numastat

1.11 numad

shared memory utilities

本文为摘录(或转载),侵删,原文为: https://linuxopsys.com/topics/check-shared-memory-in-linux

1 RTFM…

1.1 ipcs

1.2 ipcrm

2 Check shared memory in Linux

Print active shared memory segments using -m option.

1
2
3
4
5
# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 root 600 393216 2 dest
0x00000000 98305 root 600 393216 2 dest

where,

std::initializer_list in C++

本文为摘录(或转载),侵删,原文为: https://www.cppstories.com/2023/initializer_list_improvements/

1 Referencing local array

std::initializer_list 在使用中会转化成为常量对象的匿名局部数组:

1
2
3
4
5
6
std::initializer_list<int> wrong() { // for illustration only!
    return { 1, 2, 3, 4};
}
int main() {
    std::initializer_list<int> x = wrong();
}

The above code is equivalent to the following:

The mapping of oid and relfilenode in PG

本文为摘录(或转载),侵删,原文为: https://www.highgo.ca/2021/01/12/the-mapping-of-oid-and-relfilenode-in-pg/

A table in PostgreSQL has a relfilenode value, which specifies the file name of the table on disk (except foreign table and partition table). In general, this value can be found in the relfilenode field of the pg_class table, but there are some specific tables whose query result in the relfilenode field is 0. This blog will explore the kernel processing of these special tables relfilenode.