I recently ran into a classic case of "our code is using way more memory than it should". So I took my first dive into memory profiling Rust code. I read several posts about this, including the following
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: | |
gcc -O0 -g3 -Wall -Wextra -Wconversion -Wdouble-promotion \ | |
-Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion \ | |
main.c | |
format: | |
clang-format -i main.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pool | |
import ( | |
"fmt" | |
"sync" | |
"runtime" | |
) | |
// GoroutinePool pools Goroutines to avoid performance penalties associated with spawning many | |
// short-lived goroutines that each have to individually grow their stack. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE payment_types ( | |
payment_type UInt8, | |
description String | |
) | |
ENGINE = MergeTree | |
ORDER BY payment_type; | |
INSERT INTO payment_types(payment_type, description) VALUES | |
(1, 'credit card'), | |
(2, 'cash'), |
Recently I have had to deal with Salt configuration. I am doing product work so I didn't want to focus too much on deeply grasping Salt, but instead knowing the terminology equivalents to Chef/Puppet which I am comfortable with.
Salt | Chef | Puppet |
---|---|---|
state | resource | resource |
states | recipes | manifests |
formula* | cookbook | module |
pillars | databags | hiera |
grains | ohai | facter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "snake_game" | |
version = "0.1.0" | |
authors = ["youcodethings <spyr1014@gmail.com>"] | |
[dependencies] | |
piston = "0.36.0" | |
piston2d-graphics = "0.26.0" | |
pistoncore-glutin_window = "0.45.0" | |
piston2d-opengl_graphics = "0.52.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
We're looking at CPU bandwidth control via CFS:
Program does number of iterations, in each iteration we burn CPU in small chunks until we get 5ms of real time spent. On each iteration we also print how much
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert resources.requests.memory into JVM heap sizes. | |
{{- define "memoryRequest" -}}{{ include "_memoryRequest" . | trim | trimSuffix "i" | lower }}{{- end -}} | |
{{- define "_memoryRequest" -}} | |
{{- $default := "256m" -}} | |
{{ if .Values.resources }} | |
{{ if (hasKey .Values.resources "requests") }} | |
{{ if (hasKey .Values.resources.requests "memory") }} | |
{{ .Values.resources.requests.memory }} | |
{{ else }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zookeeper connection string | |
{{- define "zookeepers" -}}{{ include "_zookeepers" . | trim | replace "\n\n" "," | nospace }}{{- end -}} | |
{{- define "_zookeepers" -}} | |
{{ $values := . }} | |
{{ range $i, $e := until (int .Values.zookeeper.replicaCount) }} | |
{{ template "zookeeperName" $values }}-{{ $i }}.{{ template "headlessZookeeper" $values }} | |
{{ end }} | |
{{- end -}} |
NewerOlder