tag: c++

C++ to Go

created: 2022-12-04 | updated: 2022-12-10

C++ to Go

Introducing Ziegel

박재완


Luft

  • Ziegel and TrailDB

Luft

  • OLAP database for analize the analyzing user behavior in real-time
  • Use TrailDB as a storage
  • Written in C/C++ and Go

TrailDB

  • TrailDB is an efficient tool for storing and querying series of events
  • Written in C

Ziegel

  • New storage engine for the Luft
  • Written in Go

Why?

  • TrailDB has been a suitable solution for the Luft
  • But development was halted in 2019
  • Issues with peformance and productivity

Issues

  1. Inefficient multi-core utilization
// finalize. this could take a while with idle CPU usage but don't panic.
// it's not freeze;
// it's because TrailDB indexing process is not parallelized yet :(
  1. Row store data structure
  2. Use multiple language: C/C++ and Go

Journey for the migration

  1. Add more tests for consistency verification
  2. Add interface for engine replacement
    • With this interface, we can easily replace the engine(partial or full)
  3. Implement storage engine
  4. Peformance tuning
    • 2x fater for the ingestion, 1.2 slower for the query

Peformance tuning


Measuring performance

Go provides great tools for measuring performance.

C++ good reads

created: 2022-09-18 | updated: 2023-01-29

C++ STL performance example with shared_ptr

I just have to say this and move on… If you think it’s okay to just use the STL for a project that doesn’t need this level of optimization or performance, think again.

It is highly likely that your project is not suitable for writing Non GC Native language, so it is recommended to replace it with a VM-based language. I don’t use C++ anymore for 99% of my projects. Most of them are solved with C#, Kotlin, and TypeScript.

컴파일 시점에 printf 오류 검사

created: 2022-02-06 | updated: 2022-02-06

언리얼 엔진의 UE_LOG 매크로는 컴파일 시점에 입력값의 오류를 검사하지 않습니다.

따라서 실행 중 로그를 기록하려다 의도하지 않은 동작(크래시 등)을 발생시킬 위험이 있습니다.

예)

FString temp;
UE_LOG(LogClass, Log, TEXT("%d, %s"), *temp);

_stprintf_s

C++

created: 2020-04-19 | updated: 2022-09-18

std::shared_ptr 는 쓰레드 세이프하지 않음

created: 2018-09-03 | updated: 2020-08-05

std::shared_ptr 는 쓰레드 세이프하지 않습니다. 관련 예제와 볼만한 링크를 남깁니다.