Experiment with making Python go faster

The goal is to put the compiled pyc files in the APE ZIP.
This commit is contained in:
Justine Tunney 2021-08-18 21:57:11 -07:00
parent 4486ad5c9e
commit ebb8c85496
33 changed files with 9483 additions and 1859 deletions

View file

@ -1556,6 +1556,9 @@ static int _PyCodecRegistry_Init(void)
interp->codec_error_registry == NULL)
Py_FatalError("can't initialize codec registry");
/*
* XXX: terrible design!
*/
mod = PyImport_ImportModuleNoBlock("encodings");
if (mod == NULL) {
return -1;

View file

@ -40,11 +40,6 @@
/* See _PyImport_FixupExtensionObject() below */
static PyObject *extensions = NULL;
/* This table is defined in config.c: */
extern struct _inittab _PyImport_Inittab[];
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
static PyObject *initstr = NULL;
/*[clinic input]

View file

@ -6,7 +6,12 @@
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* Auto-generated by Programs/_freeze_importlib.c */
/*
* Auto-generated by
* m/third_party/python/freeze.com \
* third_party/python/Lib/importlib/_bootstrap.py \
* third_party/python/Python/importlib.inc
*/
const unsigned char _Py_M__importlib[] = {
99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,

View file

@ -6,7 +6,12 @@
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* Auto-generated by Programs/_freeze_importlib.c */
/*
* Auto-generated by
* m/third_party/python/freeze.com \
* third_party/python/Lib/importlib/_bootstrap_external.py \
* third_party/python/Python/importlib_external.inc
*/
const unsigned char _Py_M__importlib_external[] = {
99,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,

View file

@ -305,7 +305,8 @@ import_init(PyInterpreterState *interp, PyObject *sysmod)
Py_DECREF(value);
Py_DECREF(impmod);
_PyImportZip_Init();
/* just add zip!.python/ to sys.path */
/* _PyImportZip_Init(); */
}

View file

@ -4,6 +4,7 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/stdio/stdio.h"
#include "libc/unicode/locale.h"
#include "third_party/python/Include/Python-ast.h"
#include "third_party/python/Include/abstract.h"
@ -26,6 +27,7 @@
#include "third_party/python/Include/pydebug.h"
#include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pylifecycle.h"
#include "third_party/python/Include/pythonrun.h"
#include "third_party/python/Include/setobject.h"
#include "third_party/python/Include/symtable.h"
#include "third_party/python/Include/sysmodule.h"