Skip to content

Instantly share code, notes, and snippets.

View jiacai2050's full-sized avatar
:atom:
Focusing

Jiacai Liu jiacai2050

:atom:
Focusing
View GitHub Profile
@jiacai2050
jiacai2050 / before
Last active August 31, 2021 00:28
emacs init benchmark
Benchmark results
╼►[benchmark-init/root nil 6987ms]
├─[xdg require 14ms]
├─[swiper require 12ms]
├─[/Applications/Emacs.app/Contents/Resources/lisp/term/xterm.elc load 6ms]
├─[vc-git load 22ms]
│ ╰─[diff-mode require 18ms]
├─[~/.config/emacs/etc/yasnippet/snippets/emacs-lisp-mode/.yas-setup load 0ms]
├─[~/.config/emacs/etc/yasnippet/snippets/emacs-lisp-mode/.yas-compiled-snippets load 0ms]
@jiacai2050
jiacai2050 / name-calling.md
Created February 24, 2021 15:03 — forked from coolaj86/name-calling.md
What we call programmers - because labels make us happy! http://youtu.be/uxeR95aYer0#t=58
@jiacai2050
jiacai2050 / latency.txt
Created January 10, 2021 09:33 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
trait Engine {
fn eval(&self) -> String;
}
struct JSEngine {
name: String,
}
impl JSEngine {
fn new(name: String) -> Self {
{:description "Blog-backup config"
:home-page "https://github.com/jiacai2050/blog-backup"
:blogs [{:id "go-blog"
:base-url "https://blog.golang.org/index"
:posts-selector "div#content > p > a"
:page-tmpl "{{base-url}}"
:total-page 1}
{:id "meituan"
:base-url "https://tech.meituan.com/"
:posts-selector "div.post-container > h2 > a"
;; (macroexpand '(go (<p! (.launch puppeteer pp-opts))))
(let*
[c__25860__auto__ (cljs.core.async/chan 1)]
(cljs.core.async.impl.dispatch/run
(clojure.core/fn
[]
(clojure.core/let
[f__25861__auto__
(clojure.core/let
@jiacai2050
jiacai2050 / output.txt
Created April 18, 2020 02:50
Example to reproduce stackoverflow error
thread '
thread 'outer-thread-0' has overflowed its stack
fatal runtime error: stack overflow
outer-thread-1' has overflowed its stack
fatal runtime error: stack overflow
Aborted (core dumped)
@jiacai2050
jiacai2050 / bench_test.go
Created March 15, 2020 05:23
go value vs pointer benchmark
package main
import "testing"
var blackholeStr = ""
var blackholeValue student
var blackholePointer *student
func BenchmarkPointerVSStruct(b *testing.B) {
@jiacai2050
jiacai2050 / web.go
Last active August 25, 2020 04:27
A simple web app demonstrate how to deal with err in handler
package main
import (
"bytes"
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"os"