Artem Krylysov

String interning in Go

String interning is a technique of storing only one copy of each unique string in memory. It can significantly reduce memory usage for applications that store many duplicated strings.

Handling C++ exceptions in Go

Cgo is a mechanism that allows Go packages call C code. The Go compiler enables cgo for every .go source file that imports a special pseudo package "C". The text in the comment before the import "C" line is treated as a C code. You can include headers, define functions, types and variables - everything a normal C code can do:

package main

#include <stdio.h>

void foo(int x) {
    printf("x: %d\n", x);
import "C"

func main() { // x: 123

Profiling and optimizing Go web applications

Go has a powerful built-in profiler that supports CPU, memory, goroutine and block (contention) profiling.

Enabling the profiler #

Go provides a low-level profiling API runtime/pprof, but if you are developing a long-running service, it's more convenient to work with a high-level net/http/pprof package.

All you need to enable the profiler is to import net/http/pprof and it will automatically register the required HTTP handlers:

package main

import (
    _ "net/http/pprof"

func hiHandler(w http.ResponseWriter, r *http.Request) {

func main() {
    http.HandleFunc("/", hiHandler)
    http.ListenAndServe(":8080", nil)

Iceland 2016

Summers are so hot in Philadelphia, we decided to chill out a little bit in Iceland on the way back to the USA from Russia. Also, spending a vacation only for Russia is a total waste.

Turks & Caicos

Late December, 70 °F (21 °C), the winter hasn't arrived in Philadelphia yet, but we decided to spend our "winter break" lying on the beach. There are many destinations within a short flight from the USA - Mexico, Cuba and a dozen of small island countries. For some places like Florida, Hawaii, Puerto Rico, US Virgin Islands you don't even need to leave the territory of the country.

Benchmark of Python JSON libraries

This post was updated on 2016/08/13: added python-rapidjson; updated simplejson and ujson.

A couple of weeks ago after spending some time with Python profiler, I discovered that Python’s json module is not as fast as I expected. I decided to benchmark alternative JSON libraries.

Page 1 of 3