JIT Just-in-time compilation динамическая компиляция. Технология увеличения производительности программ, использующих байт-код, путём компиляции байт-кода в машинный код непосредственно во время работы. Так достигается высокая скорость выполнения по сравнению с интерпретируемым байт-кодом (сравнимая с компилируемыми языками) за счёт увеличения потребления памяти (для хранения результатов компиляции) и затрат времени на компиляцию. Из-за того что компиляция произходит во время исполнения можно проводить различные оптимизации, например, компиляция может осуществляться непосредственно для целевого CPU и операционной системы (SSE, MMX), profile-guided optimizations - cреда может собирать статистику о работающей программе и производить оптимизации с учётом этой информации; cреда может делать глобальные оптимизации кода (встраивание библиотечных функций в код, pseudo-constant propagation или indirect/virtual function inlining); перестраив
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
| # http://lwn.net/Articles/655992/ | |
| # https://github.com/mfleming/bits/blob/master/python/bits/__init__.py | |
| import bits | |
| from ctypes import * | |
| mem = (c_char * 128).from_address(0xf1390) | |
| print bits.dumpmem(mem) | |
| # 00000000: 2f 68 6f 6d 65 2f 6a 6f 73 68 ... /home/josh... |
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
| define pyp | |
| set \$\_unused\_void = PyObject\_Print($arg0, stderr, 1) | |
| printf "\n" | |
| end |
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
| DELIMITER $ | |
| CREATE PROCEDURE fill_test_table(x1 INT, x2 INT) | |
| BEGIN | |
| SET @x = x1; | |
| REPEAT | |
| INSERT INTO test_table SET id=@x, insert_time=UNIX_TIMESTAMP(); | |
| SET @x = @x + 1; | |
| UNTIL @x > x2 END REPEAT; | |
| END$ |
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
| /* | |
| https://en.wikipedia.org/wiki/Time_Stamp_Counter | |
| https://ru.wikipedia.org/wiki/Rdtsc | |
| */ | |
| #include <stdio.h> | |
| typedef unsigned long long uint64; | |
| int main() { |
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 string | |
| # In [1]: string.punctuation | |
| # Out[1]: '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' | |
| # In [2]: string.uppercase | |
| # Out[2]: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
| # In [3]: " " * len(string.punctuation) + string.lowercase | |
| # Out[3]: ' abcdefghijklmnopqrstuvwxyz' |
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 sqlparse | |
| from django.conf import settings | |
| from django.db import connection, reset_queries | |
| settings.DEBUG = True | |
| reset_queries() | |
| # do orm queries... | |
| for q in connection.queries: |
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
| row, col, data = [], [], [] | |
| row_idx = -1 | |
| y = [] | |
| feature_counter = Counter() | |
| for file_path in data_path.glob(DATA_FILES_PATTERN): | |
| print(file_path) | |
| with open(Path(file_path).expanduser(), 'r') as data_file: | |
| class_idx = BLOCK_CLASSES[file_path.stem] |
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 glob | |
| import os | |
| import cv2 | |
| import concurrent.futures | |
| def load_and_resize(image_filename): | |
| ### Read in the image data | |
| img = cv2.imread(image_filename) | |
Drain mode = no longer accept new incoming requests
lspci -k | grep -A 2 -E '(3D|VGA)'
# lspci -k | grep -A 2 -E '(3D|VGA)'
# 00:08.0 VGA compatible controller: NVIDIA Corporation GR666GL [GeForce GX 666] (rev a0)
# Kernel driver in use: nvidia
# Kernel modules: nvidiafb, nouveau, nvidia
# set persistence mode offOlderNewer