Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
@mratsim
mratsim / libdispatch-efficiency-tips.md
Created July 15, 2019 10:14 — forked from tclementdev/libdispatch-efficiency-tips.md
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

I suspect most developers are using the libdispatch inefficiently due to the way it was presented to us at the time it was introduced and for many years after that, and due to the confusing documentation and API. I realized this after reading the 'concurrency' discussion on the swift-evolution mailing-list, in particular the messages from Pierre Habouzit (who is the libdispatch maintainer at Apple) are quite enlightening (and you can also find many tweets from him on the subject).

My take-aways are:

  • You should have very few queues that target the global pool. If all these queues are active at once, you will get as many threads running. These queues should be seen as execution contexts in the program (gui, storage, background work, ...) that benefit from executing in parallel.
type
Function = ref object
stages: seq[Stage]
output: Parameter
schedule: FunctionSchedule
Call = ref object
function: Function
params: seq[LuxNode]
@mratsim
mratsim / 2019-07-11_Eth2.0_Impl_Call_21.md
Last active July 11, 2019 15:38
2019-07-11 Eth2.0 Impl Call 21

2019-07-11 Eth2.0 Impl Call 21


Nimbus

Core:

  • Testnet1 -based on libp2p-daemon, launched this morning, need to adapt the script to start it with a single command (libp2p-daemon not build)
/* Generated by Nim Compiler v0.19.6 */
/* (c) 2018 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
gcc -c -w -I/home/beta/.choosenim/toolchains/nim-0.19.6/lib -o /home/beta/.cache/nim/e12_syntax_revamp_d/e12_syntax_revamp.c.o /home/beta/.cache/nim/e12_syntax_revamp_d/e12_syntax_revamp.c */
#define NIM_NEW_MANGLING_RULES
#define NIM_INTBITS 64
#include "nimbase.h"
@mratsim
mratsim / keyservers.md
Created June 30, 2019 09:51 — forked from rjhansen/keyservers.md
SKS Keyserver Network Under Attack

SKS Keyserver Network Under Attack

This work is released under a Creative Commons Attribution-NoDerivatives 4.0 International License.

Terminological Note

"OpenPGP" refers to the OpenPGP protocol, in much the same way that HTML refers to the protocol that specifies how to write a web page. "GnuPG", "SequoiaPGP", "OpenPGP.js", and others are implementations of the OpenPGP protocol in the same way that Mozilla Firefox, Google Chromium, and Microsoft Edge refer to software packages that process HTML data.

Who am I?

@mratsim
mratsim / eth2_impl_call.md
Last active June 27, 2019 15:24
ETH2.0 Implementers call #20
@mratsim
mratsim / eth2_impl_call_19.md
Created June 13, 2019 15:32
Eth2.0 implementer's call #19

Eth2.0 implementer's call #19

ethereum/eth2.0-pm#45

Specs:

  • 2 PRs pending for 0.7.0 compat

Sync:

  • backward sync integrated (request all blocks up to a point)

Networking:

ethereum/eth2.0-pm#43


Nimbus

  • Several people in holidays
  • Debugging multithreading issues

Networking:

  • Forward and backward sync
import posix
import strutils
when defined(macosx):
const
libName = "libpcap.dylib"
defaultIfName* = "en0"
else:
# where is u_int type defined for pcap.h??
import hashes, sets, random, sequtils, times
const IntSize = sizeof(int)
proc randomString(len: Natural): string =
result = newString(len)
for c in result.mitems:
c = rand('a'..'z')
proc sum[T](x: seq[T]): T =