<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>索拉尔的主页</title>
  <subtitle>赞美太阳</subtitle>
  <link href="http://redhand.com.cn/atom.xml" rel="self"/>
  <link href="http://redhand.com.cn/"/>
  <updated>2025-06-23T13:11:09.000Z</updated>
  <id>http://redhand.com.cn/</id>
  <author><name>张健</name></author>
  <entry>
    <title>android native如何统计编译耗时</title>
    <link href="http://redhand.com.cn/posts/android-native-build-trace/"/>
    <id>http://redhand.com.cn/posts/android-native-build-trace/</id>
    <published>2025-06-23T13:11:09.000Z</published>
    <updated>2025-06-23T13:11:09.000Z</updated>
    <summary>在进行C++开发时，我们有时需要统计项目的编译耗时情况，以便定位导致编译速度变慢的~~罪魁祸首~~。</summary>
    <category term="cpp"/>
    <category term="android"/>
  </entry>
  <entry>
    <title>在服务器上搭建perplexia</title>
    <link href="http://redhand.com.cn/posts/perplexia/"/>
    <id>http://redhand.com.cn/posts/perplexia/</id>
    <published>2025-02-21T18:03:00.000Z</published>
    <updated>2025-02-21T18:03:00.000Z</updated>
    <summary>Perplexia是一个人工智能搜索引擎，是Perplexity的开源替代版本。最近正好在公司内网的服务器上搭建一个Perplexia服务，记录一下中间遇到的问题，主要是来自于网络环境。</summary>
    <category term="docker"/>
    <category term="ai"/>
    <category term="llm"/>
  </entry>
  <entry>
    <title>Proxy库分析之Convention</title>
    <link href="http://redhand.com.cn/posts/proxy-convension/"/>
    <id>http://redhand.com.cn/posts/proxy-convension/</id>
    <published>2025-01-02T12:05:00.000Z</published>
    <updated>2025-01-02T12:05:00.000Z</updated>
    <summary>proxy库的使用请参考Proxy库的使用</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>Proxy库的使用</title>
    <link href="http://redhand.com.cn/posts/proxy/"/>
    <id>http://redhand.com.cn/posts/proxy/</id>
    <published>2025-01-02T11:51:00.000Z</published>
    <updated>2025-01-02T11:51:00.000Z</updated>
    <summary>proxy库是微软推出的一个非继承式的多态实现。无论从性能来看还是侵入性来看，proxy 都是一个对api设计比较友好的库。 proxy在3.0版本中更新了使用方式，改进了之前写法过于难懂（丑）的问题。因此如果在业务中有需求的还是可以一试。</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>游戏引擎在安卓下的实现</title>
    <link href="http://redhand.com.cn/posts/android-engine/"/>
    <id>http://redhand.com.cn/posts/android-engine/</id>
    <published>2024-09-23T13:11:09.000Z</published>
    <updated>2024-09-23T13:11:09.000Z</updated>
    <summary>一般游戏引擎都是使用c++实现逻辑，再通过一个虚拟机实现用脚本语言维护业务逻辑。因此在安卓下进行一层包装是十分必要的，使得引擎能够和安卓接口交互，也能正确地管理生命周期。</summary>
    <category term="cpp"/>
    <category term="android"/>
  </entry>
  <entry>
    <title>Cap&#39;n Proto的编码格式分析</title>
    <link href="http://redhand.com.cn/posts/Capn-Proto/"/>
    <id>http://redhand.com.cn/posts/Capn-Proto/</id>
    <published>2024-06-16T13:11:09.000Z</published>
    <updated>2024-06-16T13:11:09.000Z</updated>
    <summary>Cap&#39;n Proto是一个高性能的数据交换格式，而且还附带了一套性能优良的RPC框架实现。是Protobuf2的作者Kenton Varda于 2013 年 4 月开源发布的，开源10年之后也在23年发布了第一个稳定支持版本1.0。 Cap&#39;n Proto号称编解码接近0开销，比protobuf快无数倍。当然我们想想也知道这是个不现实的事情，但是能这么说肯定是它在速度上有两把刷子，因此本文我们就</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>lambda捕获变量在c++协程中的生命周期</title>
    <link href="http://redhand.com.cn/posts/lambda-coroutine/"/>
    <id>http://redhand.com.cn/posts/lambda-coroutine/</id>
    <published>2024-04-12T14:55:00.000Z</published>
    <updated>2024-04-12T14:55:00.000Z</updated>
    <summary>最近在实现一个基于c++20的协程库，当我把lambda和协程组合在一起用的时候，出现了capture变量失效的问题。最后发现是因为capture变量的生命周期的问题。</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>c++中的memory order问题</title>
    <link href="http://redhand.com.cn/posts/memory-order/"/>
    <id>http://redhand.com.cn/posts/memory-order/</id>
    <published>2024-03-17T09:33:00.000Z</published>
    <updated>2024-03-17T09:33:00.000Z</updated>
    <summary>在C++中，我们使用atomic时会发现相关操作都有一个可选的参数std::memoryorder，本文就分析以下这几种memoryorder的用法，以方便大家写出更加高效的多线程代码。</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>c++使用placement new解决静态变量析构顺序问题</title>
    <link href="http://redhand.com.cn/posts/inplace_new/"/>
    <id>http://redhand.com.cn/posts/inplace_new/</id>
    <published>2024-02-14T13:13:00.000Z</published>
    <updated>2024-02-14T13:13:00.000Z</updated>
    <summary>在日常工作中，我们经常会遇到使用静态变量来保存唯一实例，例如著名的Meyer单例模式，可以在c++11的下不经过加锁就能实现线程安全的单例模式。但是静态变量如果在析构函数中也引用到了其他静态变量（最常见的就是Logger实例是一个静态变量时，在析构函数中记录了日志）。 本文中我们探讨了如何使用placement new绕开静态变量生命周期的问题。</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>c++的右值引用和完美转发</title>
    <link href="http://redhand.com.cn/posts/right-value/"/>
    <id>http://redhand.com.cn/posts/right-value/</id>
    <published>2023-10-24T14:13:29.000Z</published>
    <updated>2023-10-24T14:13:29.000Z</updated>
    <summary>右值引用，完美转发这些概念很多时候会让人弄不清楚概念。这篇文章中就让我们再来试图搞懂它们的区别和用法。</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>使用自定义指标实现HPA</title>
    <link href="http://redhand.com.cn/posts/prometheus-hpa/"/>
    <id>http://redhand.com.cn/posts/prometheus-hpa/</id>
    <published>2023-09-15T14:13:29.000Z</published>
    <updated>2023-09-15T14:13:29.000Z</updated>
    <summary>在云原生的开发下，POD一般都需要自动扩缩容以适应业务的开发环境（否则不如直接部署在VPS上了）。传统的HPA会使用CPU或者内存来扩缩容，但是对于某些特殊业务，我们会根据自定义指标（例如qps，特殊资源的使用情况）来决定是否需要扩容。</summary>
    <category term="go"/>
    <category term="k8s"/>
  </entry>
  <entry>
    <title>在redis-cluster模式下使用lua脚本</title>
    <link href="http://redhand.com.cn/posts/rediscluster-lua/"/>
    <id>http://redhand.com.cn/posts/rediscluster-lua/</id>
    <published>2023-09-03T14:13:29.000Z</published>
    <updated>2023-09-03T14:13:29.000Z</updated>
    <summary>由于redis cluster不支持事务，在一些原子性的操作时无法使用Multi。因此lua脚本成了最合适的选择，但是由于redis在cluster下多个slot的问题，使用lua稍不注意会导致很多问题。</summary>
    <category term="redis"/>
    <category term="lua"/>
  </entry>
  <entry>
    <title>protobuf的二进制编码结构</title>
    <link href="http://redhand.com.cn/posts/protobuf-layout/"/>
    <id>http://redhand.com.cn/posts/protobuf-layout/</id>
    <published>2023-08-29T02:23:36.000Z</published>
    <updated>2023-08-29T02:23:36.000Z</updated>
    <summary>Protocol Buffers是一种跨平台的序列化数据结构协议，通过.proto文件作为DSL描述，并且将数据以二进制方式字节流方式编码。了解protobuf的编码方式，对于合理组织自己的协议，以及优化业务代码都比较有帮助。</summary>
    <category term="protobuf"/>
    <category term="go"/>
  </entry>
  <entry>
    <title>使用Kind在windows上搭建个人用的k8s</title>
    <link href="http://redhand.com.cn/posts/kind/"/>
    <id>http://redhand.com.cn/posts/kind/</id>
    <published>2023-08-10T12:23:36.000Z</published>
    <updated>2023-08-10T12:23:36.000Z</updated>
    <summary>在学习k8s的过程中，出于实践的需要，我们经常需要对k8s集群做一些敏感操作，例如使用hostpath，安装daemonset。所以在自己的开发机上组建一个简单的k8s集群是很必要的。本文将会介绍如何使用wsl+Kind搭建一个k8s集群。</summary>
    <category term="go"/>
    <category term="k8s"/>
  </entry>
  <entry>
    <title>wire使用技巧</title>
    <link href="http://redhand.com.cn/posts/wire/"/>
    <id>http://redhand.com.cn/posts/wire/</id>
    <published>2023-07-10T12:23:36.000Z</published>
    <updated>2023-07-10T12:23:36.000Z</updated>
    <summary>在写go项目时，我们一般对于一些依赖的资源和类会通过依赖注入的方式来解决对象初始化流程耦合的问题。不同于dig和inject这两个工具通过反射来实现依赖注入，wire是通过代码生成的方式。相比之下整体流程更加易懂直观。</summary>
    <category term="go"/>
    <category term="wire"/>
  </entry>
  <entry>
    <title>protoc插件编写</title>
    <link href="http://redhand.com.cn/posts/go-protoc/"/>
    <id>http://redhand.com.cn/posts/go-protoc/</id>
    <published>2023-05-22T08:57:29.000Z</published>
    <updated>2023-05-22T08:57:29.000Z</updated>
    <summary>利用protoc，可以解析protobuf文件生成。一般来说都是通过自定义插件，调用库方法来实现。官方的protobuf解析实际上也是利用插件完成的，例如protoc-gen-go。</summary>
    <category term="go"/>
    <category term="protobuf"/>
  </entry>
  <entry>
    <title>ADL，CPO和tag_invoke</title>
    <link href="http://redhand.com.cn/posts/cpo/"/>
    <id>http://redhand.com.cn/posts/cpo/</id>
    <published>2023-04-18T03:48:09.000Z</published>
    <updated>2023-04-18T03:48:09.000Z</updated>
    <summary>在executor提案出现之后，有关于cpo和taginvoke的话题就变得很常见。这几个功能，包括ADL都是为了解决在不同的namespace下如何正确的匹配到对应的方法的问题。</summary>
    <category term="cpp"/>
  </entry>
  <entry>
    <title>linux进程内存占用分析</title>
    <link href="http://redhand.com.cn/posts/using-tcmalloc/"/>
    <id>http://redhand.com.cn/posts/using-tcmalloc/</id>
    <published>2023-03-27T03:48:09.000Z</published>
    <updated>2023-03-27T03:48:09.000Z</updated>
    <summary>线上服务一般都会遇到因为代码bug或者逻辑不合理导致内存占用暴涨的情况（例如内存泄露），也有可能在线上环境发现内存占用太高和预估不符的情况。单纯分析代码人肉查问题不总是靠谱，此时最直观的方式就是profile进程的内存占用问题。如果遇到了c/c++开发的服务，或者需要分析类似java堆外内存泄露的问题，gperf（tcmalloc）是一个比较好的选择。</summary>
    <category term="linux"/>
  </entry>
  <entry>
    <title>c++泛型返回值类型推导</title>
    <link href="http://redhand.com.cn/posts/template-return-deduction/"/>
    <id>http://redhand.com.cn/posts/template-return-deduction/</id>
    <published>2022-03-25T04:32:11.000Z</published>
    <updated>2022-03-25T04:32:11.000Z</updated>
    <summary>C++模板参数类型推导 在c++模板中，可以使用以下代码来根据类型推导来定制模板代码：</summary>
    <category term="cpp"/>
    <category term="template"/>
  </entry>
</feed>
