Map [1]
Operation | Time Complexity |
---|---|
Access | O(log n) |
Search | O(log n) |
Insertion | O(n) for <= 32 elements, O(log n) for > 32 elements [2] |
Deletion | O(n) for <= 32 elements, O(log n) for > 32 elements |
defmodule Example.Poller do | |
use GenServer | |
@backoff [ | |
50, | |
100, | |
150, | |
250, | |
400, | |
650 |
(defface tree-sitter-hl-face:warning | |
'((default :inherit font-lock-warning-face)) | |
"Face for parser errors" | |
:group 'tree-sitter-hl-faces) | |
(defun hook/tree-sitter-common () | |
(unless font-lock-defaults | |
(setq font-lock-defaults '(nil))) | |
(setq tree-sitter-hl-use-font-lock-keywords nil) | |
(tree-sitter-mode +1) |
# This is the proper BEAM test for https://github.com/uber/denial-by-dns. The Erlang test in that repo is sequential | |
# (https://github.com/uber/denial-by-dns/blob/b809cc561a691d9d6201d06d38d06c33c9c9f9ec/erlang-httpc/main.erl) | |
# which is not consistent with the test description (https://github.com/uber/denial-by-dns/tree/b809cc561a691d9d6201d06d38d06c33c9c9f9ec#how-it-works) | |
# and also differs from e.g. go test in the same repo which issues requests concurrently. | |
# | |
# Consequently, the conclusion in that repo as well as the original article (https://eng.uber.com/denial-by-dns/) is incorrect. | |
# A properly written Erlang test would pass, as demonstrated by this Elixir script. | |
# | |
# This code performs a slightly refined and a correct version of that tests in Elixir: | |
# |
# Lets you call a block for each item in a list, just like `each`. | |
# But instead of running serially, it runs in a limited number of parallel threads. | |
# This is useful when you don't just want one thread per item, e.g. to avoid rate limiting or network saturation. | |
class EachInThreadPool | |
def self.call(inputs, pool_size:, &block) | |
queue = Queue.new | |
inputs.each { queue << _1 } | |
pool_size.times.map { |
@spec function_name(arg_1_type, arg_2_type) :: return_type
@type new_type_name :: existing_type
@typedoc """ description """
above type definition.@type statuses :: [atom]
@type number_with_remark :: {number, String.t}
This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.
For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai
I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.
This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea
This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x
The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/