Skip to content

Instantly share code, notes, and snippets.

View bhavishyagopesh's full-sized avatar

BHAVISHYA bhavishyagopesh

View GitHub Profile
@bhavishyagopesh
bhavishyagopesh / bm_concurrent.py
Last active August 11, 2017 23:07
Benchmark concurrency.
"""
Benchmark concurrency.
"""
import perf
from six.moves import xrange
import threading
import multiprocessing
def add_cmdline_args(cmd, args):
@bhavishyagopesh
bhavishyagopesh / bm_threading.py
Last active August 10, 2017 22:32
Benchmark threading module.
"""
Benchmark threading module.
"""
# FIXME : notify hangs
import perf
from six.moves import xrange
import threading
static PyObject *
run_mod(mod_ty mod, PyObject *filename, PyObject *globals, PyObject *locals,
PyCompilerFlags *flags, PyArena *arena)
{
PyCodeObject *co;
PyObject *v;
co = PyAST_CompileObject(mod, filename, flags, -1, arena);
if (co == NULL)
return NULL;
v = PyEval_EvalCode((PyObject*)co, globals, locals);
@bhavishyagopesh
bhavishyagopesh / python
Created July 21, 2017 05:24
run_mod definition
static PyObject *
run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals,
PyCompilerFlags *flags, PyArena *arena)
{
PyCodeObject *co;
PyObject *v;
co = PyAST_Compile(mod, filename, flags, arena);
if (co == NULL)
return NULL;
v = PyEval_EvalCode(co, globals, locals);
@bhavishyagopesh
bhavishyagopesh / pythonrun.c
Created July 21, 2017 05:21
Py_InitializeEx Definition
void
Py_InitializeEx(int install_sigs)
{
PyInterpreterState *interp;
PyThreadState *tstate;
PyObject *bimod, *sysmod;
char *p;
char *icodeset = NULL; /* On Windows, input codeset may theoretically
differ from output codeset. */
char *codeset = NULL;
@bhavishyagopesh
bhavishyagopesh / pylifecycle.c
Created July 21, 2017 03:41
_Py_InitializeMainInterpreter Definition
/* Update interpreter state based on supplied configuration settings
*
* After calling this function, most of the restrictions on the interpreter
* are lifted. The only remaining incomplete settings are those related
* to the main module (sys.argv[0], __main__ metadata)
*
* Calling this when the interpreter is not initializing, is already
* initialized or without a valid current thread state is a fatal error.
* Other errors should be reported as normal Python exceptions with a
* non-zero return code.
@bhavishyagopesh
bhavishyagopesh / frontendDevlopmentBookmarks.md
Created April 23, 2017 20:44 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.