$_coder_upgrade_libraries_base = $paths['libraries_base']; $_coder_upgrade_modules_base = $paths['modules_base']; // Load core theme cache. $_coder_upgrade_theme_registry = array(); if (is_file($theme_cache)) { $_coder_upgrade_theme_registry = unserialize(file_get_contents($theme_cache)); } save_memory_usage('load core theme cache', $usage); // Load coder_upgrade bootstrap code. $path = $_coder_upgrade_modules_base . '/coder/coder_upgrade'; $files = array('coder_upgrade.inc', 'includes/main.inc', 'includes/utility.inc'); foreach ($files as $file) { require_once DRUPAL_ROOT . '/' . $path . "/{$file}"; } coder_upgrade_path_clear('memory'); print_memory_usage($usage); // $trace_base = DRUPAL_ROOT . '/' . $_coder_upgrade_files_base . '/coder_upgrade/coder_upgrade_'; // $trace_file = $trace_base . '1.trace'; // xdebug_start_trace($trace_file); coder_upgrade_memory_print('load coder_upgrade bootstrap code'); // xdebug_stop_trace(); // Apply conversion functions. $success = coder_upgrade_start($upgrades, $extensions, $items); // $trace_file = $trace_base . '2.trace'; // xdebug_start_trace($trace_file); coder_upgrade_memory_print('finish'); // xdebug_stop_trace(); return $success ? 0 : 1; /** * Returns command line arguments. *
bench_porter($words, $encoding); //bench_enchant($words); //bench_pspell($words); //print_memory_usage(); bench_morphy_dict($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_FILE); bench_morphy_dict($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_SHM); bench_morphy_dict($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_MEM); bench_morphy($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_FILE, false); bench_morphy($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_FILE, true); bench_morphy($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_SHM, false); bench_morphy($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_SHM, true); //print_memory_usage(); bench_morphy($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_MEM, false); bench_morphy($words, $encoding, $dict_dir, $lang, PHPMORPHY_STORAGE_MEM, true); //file_put_contents(__DIR__ . '/.bench.words.txt', implode(PHP_EOL, $words)); print_memory_usage(); ///////////////////////////////////////////////////////////////// function print_memory_usage() { printf("%dKb allocated\n", memory_get_usage() >> 10); } function load_words($filePath, $unique, $fileEncoding) { $contents = @iconv($fileEncoding, 'utf-8', file_get_contents($filePath)); preg_match_all('/[\\s\\"\']([А-ЯЁа-яё+-]+)/u', file_get_contents($filePath), $result); $converted = array_map('trim', $result[0]); return $unique ? array_unique($converted) : $converted; } function convert_words(&$words, $encoding, $case) { foreach ($words as &$word) {