Skip to content

Instantly share code, notes, and snippets.

View Vizonex's full-sized avatar

Vizonex Vizonex

View GitHub Profile
@Vizonex
Vizonex / uv-ares.c
Last active March 14, 2026 16:36
This is a historical document from 2012 of how C-Ares and Uvloop were originally used together. I am using it mostly for brainstorming ideas with pycares and cyares
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
@Vizonex
Vizonex / atomic.pxd
Created April 9, 2026 15:58
cyatomics is a fork of python's atomic stuff that has it's things renamed to prevent overlapping this is mostly just an idea for getting cython to someday support atomics. This was code I had left for around 3 months but was mostly just word rewriting of python's atomic structure
# Contains a collection of pyatomic functions that have been exclusively modified for the use with
# C Compiled sources for the sake of speed and needing less costly functionality
# or having to deal with the annoying headaches of adding these in yourself.
from libc.stdint cimport *
cdef extern from "cyatomics.h" nogil:
int _cyatomic_add_int(int *obj, int value)
int8_t _cyatomic_add_int8(int8_t *obj, int8_t value)
int16_t _cyatomic_add_int16(int16_t *obj, int16_t value)
@Vizonex
Vizonex / uvloop_and_winloop_enhancements.pyx
Created May 27, 2026 04:00
UVLoop Performance Enhancement ideas & Notes. This Brings in a custom Coroutine and Awaitable Container object which could vastly eliminate a lot of python heavy rendering with the main task as well as other unique stuff
cimport cython
from cpython.exc cimport PyErr_SetObject
from cpython.contextvars cimport PyContext_CopyCurrent
from asyncio import get_event_loop, format_helpers, CancelledError, InvalidStateError
import sys
from cpython.list cimport PyList_GET_SIZE
# Concept work for winloop & uvloop speedups in theory.
cdef extern from "Python.h":
@Vizonex
Vizonex / mutlidict_cython_api.pxd
Last active September 25, 2026 06:31
Multidict Cython-API Generator is a generator for cython code. This may be a lot more opinionated then what was chosen for use with the multidict C-API.
# NOTE: Generated based off the verison that was written before the first release of the New Multidict C-API
# Sources may differ as updates keep getting produced.
from cpython.object cimport (
PyObject as PyObject,
PyTypeObject as PyTypeObject
)
from libc.stdint cimport uint64_t as uint64_t
cdef extern from "multidict_capi_struct.h":