###改进算法,选择合适的数据结构
-
使用dict的查找要比list快很多
-
当要求list的交集时,转化成set来计算比较快。set的常见操作:
union: set(list1) | set(list2)
intersection: set(list1) & set(list2)
difference: set(list1) - set(list2)
| <source> | |
| type tail | |
| path /var/log/haproxy.log | |
| pos_file /var/log/td-agent/haproxy.log.pos | |
| tag haproxy.http | |
| format /^(?<syslog_time>.+) (?<source_ip>.+) (?<ps>\w+)\[(?<pid>\d+)\]: (?<c_ip>[\w\.]+):(?<c_port>\d+) \[(?<time>.+)\] (?<f_end>[\w\.-]+) (?<b_end>[\w\.-]+)\/(?<b_server>[^ ]+) (?<tq>[-]?\d+)\/(?<tw>[-]?\d+)\/(?<tc>[-]?\d+)\/(?<tr>[-]?\d+)\/(?<tt>\d+) (?<status_code>\d+) (?<bytes_read>\d+) (?<captured_request_cookie>.+) (?<captured_response_cookie>.+) (?<termination_state>.+) (?<actconn>\d+)\/(?<feconn>\d+)\/(?<beconn>\d+)\/(?<srv_conn>\d+)\/(?<retries>\d+) (?<srv_queue>\d+)\/(?<backend_queue>\d+) \"(?<http_request>.+)\"$/ | |
| time_format %d/%b/%Y:%H:%M:%S.%L | |
| </source> | |
| <match *.**> |
| ;; -*- mode: emacs-lisp -*- | |
| ;; This file is loaded by Spacemacs at startup. | |
| ;; It must be stored in your home directory. | |
| (defun dotspacemacs/layers () | |
| "Configuration Layers declaration. | |
| You should not put any user code in this function besides modifying the variable | |
| values." | |
| (setq-default | |
| ;; Base distribution to use. This is a layer contained in the directory |
| ;; Connect to ERC using a HTTP proxy : ( | |
| ;; ******************************************* | |
| (defvar http-proxy-host | |
| "www-cache.reith.bbc.co.uk") | |
| (defvar http-proxy-port 80) | |
| ;; Proxy handler | |
| ;; ******************************************* |
| source 'https://rubygems.org' | |
| gem 'fluentd' | |
| gem 'fluent-plugin-td' | |
| gem 'fluent-plugin-elasticsearch' |
| module.exports = { | |
| test : function(req, res) { | |
| setTimeout(function() { | |
| res.send({ testing : true }, 200); | |
| }, 5000); | |
| }, | |
| } |
###改进算法,选择合适的数据结构
使用dict的查找要比list快很多
当要求list的交集时,转化成set来计算比较快。set的常见操作:
union: set(list1) | set(list2)
intersection: set(list1) & set(list2)
difference: set(list1) - set(list2)
| # default.custom.yaml | |
| # save it to: | |
| # ~/.config/ibus/rime (linux) | |
| # ~/Library/Rime (macos) | |
| # %APPDATA%\Rime (windows) | |
| patch: | |
| schema_list: | |
| - schema: luna_pinyin # 朙月拼音 | |
| - schema: luna_pinyin_simp # 朙月拼音 简化字模式 |
| # The beginnings of a declarative model syntax for CoffeeScript. | |
| # SEE: http://almostobsolete.net/declarative-models-in-coffeescript.html | |
| # Thomas Parslow | |
| # Email: tom@almostobsolete.net | |
| # Twitter: @almostobsolete | |
| # The top part is the setup, see below that for the demo | |
| # To see this run right away try copy pasting it into the 'Try | |
| # CoffeeScript' box at http://jashkenas.github.com/coffee-script/ |