This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef __BaseClass__ | |
| #define __BaseClass__ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string> | |
| using namespace std; | |
| class BaseClass | |
| { | |
| public: | |
| BaseClass(){}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef __BaseClass__ | |
| #define __BaseClass__ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string> | |
| using namespace std; | |
| class BaseClass | |
| { | |
| public: | |
| BaseClass(){}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import defaultdict | |
| import re | |
| import sys | |
| all = defaultdict(dict) | |
| lineno = None | |
| for line in sys.stdin: | |
| m = re.match(r' */\* "(.*\.pyx)":(\d+)', line) | |
| if m: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| import cython | |
| import numpy as np | |
| @cython.boundscheck(False) | |
| @cython.wraparound(False) | |
| @cython.nonecheck(False) | |
| @cython.cdivision(True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fake_cythonize(patterns): | |
| import glob, json, os | |
| from distutils.extension import Extension | |
| def is_package_dir(path): | |
| return os.path.exists(os.path.join(path, '__init__.py')) | |
| def package(filename): | |
| dir = os.path.dirname(str(filename)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from libc.math cimport isnan as c_isnan | |
| from math import isnan as math_isnan | |
| from cmath import isnan as cmath_isnan | |
| from numpy import isnan as numpy_isnan | |
| cdef extern from "numpy/npy_math.h": | |
| bint npy_isnan(double x) | |
| def time_c_isnan(double value, long N=1000000): | |
| cdef bint res = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Drop this in the Demos directory of Cython and run | |
| # python setup.py build_ext --inplace && python -c 'import time_exc' | |
| # cython: cdivision=True | |
| # distutils: extra_compile_args = -O3 | |
| import time | |
| cdef int with_nothing(bint bad): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pip install cython | |
| # python setup.py build_ext --inplace; python bench-runner.py | |
| import time | |
| import apache_beam as beam | |
| from apache_beam.runners import common | |
| from apache_beam.utils.windowed_value import WindowedValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print "defining A" | |
| class A(object): | |
| def __init__(): | |
| print 'A' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Vesting scheme as a PLC contract | |
| import Control.Monad (void, when) | |
| import qualified Data.Map as Map | |
| import qualified Data.Text as T | |
| import Language.Plutus.Contract hiding (when) | |
| import qualified Language.Plutus.Contract.Typed.Tx as Typed | |
| import qualified Language.PlutusTx as PlutusTx | |
| import Language.PlutusTx.Prelude hiding (Semigroup (..), fold) | |
| import Ledger (Address, PubKeyHash, Slot (Slot), Validator, pubKeyHash) |
OlderNewer