From 78175bb93cf501bfdf63a54a5fc6b34440d60f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 4 Jun 2025 10:11:57 +0200 Subject: [PATCH] Cython --- README.md | 4 ++-- index.html | 8 ++++---- parse.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b64c5b5..f40a7ca 100644 --- a/README.md +++ b/README.md @@ -3515,14 +3515,14 @@ Appendix # $ pip3 install cython import pyximport; pyximport.install() # Module that runs imported Cython scripts. import # Script must be saved with '.pyx' extension. -.main() # Main() isn't automatically executed. ``` #### All `'cdef'` definitions are optional, but they contribute to the speed-up: ```python cdef [*] [= ] -cdef [n_elements] [= ] +cdef [n_items] [= ] +cdef * = < *> malloc(n_items * sizeof()) cdef ( [*]): ... ``` diff --git a/index.html b/index.html index 79d802a..d2d9abb 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@
- +
@@ -2876,13 +2876,13 @@ px.line(df, x='Date', y=#Appendix

Cython

Library that compiles Python-like code into C.

# $ pip3 install cython
 import pyximport; pyximport.install()  # Module that runs imported Cython scripts.
 import <cython_script>                 # Script must be saved with '.pyx' extension.
-<cython_script>.main()                 # Main() isn't automatically executed.
 

All 'cdef' definitions are optional, but they contribute to the speed-up:

cdef <ctype/type> [*]<var_name> [= <obj>]
-cdef <ctype>[n_elements] <var_name> [= <coll_of_nums>]
+cdef <ctype>[n_items] <array_name> [= <coll_of_nums/structs>]
+cdef <ctype> *<array_name> = <<ctype> *> malloc(n_items * sizeof(<ctype>))
 cdef <ctype/type/void> <func_name>(<ctype/type> [*]<arg_name>): ...
 
@@ -2939,7 +2939,7 @@ $ deactivate # Deactivates the active diff --git a/parse.js b/parse.js index 41bfb6b..57a4e42 100755 --- a/parse.js +++ b/parse.js @@ -325,10 +325,10 @@ const GROUPBY = '3 1 2\n' + '6 11 13'; - const CYTHON_1 = 'cdef <ctype/type> [*]<var_name> [= <obj>]\n' + - 'cdef <ctype>[n_elements] <var_name> [= <coll_of_nums>]\n' + + 'cdef <ctype>[n_items] <array_name> [= <coll_of_nums/structs>]\n' + + 'cdef <ctype> *<array_name> = <<ctype> *> malloc(n_items * sizeof(<ctype>))\n' + 'cdef <ctype/type/void> <func_name>(<ctype/type> [*]<arg_name>): ...\n'; const CYTHON_2 =