Skip to content

Instantly share code, notes, and snippets.

View kakilangit's full-sized avatar
🏖️
Vacationing

kakilangit kakilangit

🏖️
Vacationing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kakilangit on github.
  • I am kakilangit (https://keybase.io/kakilangit) on keybase.
  • I have a public key ASDbh6yjXC4STGn1eDVC5QdtH1d973i0m2xoOesqz5bLiwo

To claim this, I am signing this object:

@kakilangit
kakilangit / background.swift
Last active January 15, 2016 09:51
Background Thread Reusable function
func backgroundThread(delay: Double = 0.0, background: (() -> Void)? = nil, completion: (() -> Void)? = nil) {
dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_USER_INITIATED.rawValue), 0)) {
if(background != nil){ background!(); }
let popTime = dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC)))
dispatch_after(popTime, dispatch_get_main_queue()) {
if(completion != nil){ completion!(); }
}
}
}
@kakilangit
kakilangit / gist:797b6ae6291c1bd7712c
Last active December 23, 2022 18:35
Pony VS Golang Thread Ring Benchmarks
## Rule: http://benchmarksgame.alioth.debian.org/u32/performance.php?test=threadring#about
## Source Code: https://github.com/kakilangit/benchmarks/tree/master/thread-ring
# Model Name: MacBook Pro
# Model Identifier: MacBookPro11,1
# Processor Name: Intel Core i5
# Processor Speed: 2.6 GHz
# Number of Processors: 1
# Total Number of Cores: 2
#pass=50.000.000 threads/actors/goroutines=503
@kakilangit
kakilangit / ab.go
Created April 17, 2013 08:09
serve 1MB per request
package main
import "net/http"
func main() {
bytes := make([]byte, 1024*1024)
for i := 0; i < len(bytes); i++ {
bytes[i] = 100
}
Server Software:
Server Hostname: localhost.local
Server Port: 8000
Document Path: /
Document Length: 1048576 bytes
Concurrency Level: 100
Time taken for tests: 28.764 seconds
Complete requests: 10000