Simple and/or classless
Correctly prioritizing and targeting performance problems and optimization opportunities is one of the hardest things to master in programming. There are a lot of ways to do it wrong: by prematurely optimizing non-bottlenecks, or preferring fast solutions to clear solutions, or measuring problems incorrectly.
I'll try to summarize what I've learned about doing this right.
First, don't optimize until there's an issue. And issues should be defined as application issues: performance problems that are either detectable by the users (lag) or endanger the platform – i.e. problems that cause downtime, like out-of-memory issues. Until there's an issue, don't think about peformance at all: just solve the problem at hand, which is "creating value for the end-user," or some less-corporate translation of the same.
Second, only optimize with instruments. By instruments, I mean technology that lets you decipher which sub-part of the stack is the bottleneck. Let's say you see slowness around fet
[ | |
{ | |
"begin": "00:00:07", | |
"end": "00:00:09", | |
"text": "[metallic clang]" | |
}, | |
{ | |
"begin": "00:02:30", | |
"end": "00:02:32", | |
"text": "[metallic clang]" |
#!/usr/bin/env python | |
''' via https://github.com/whoshuu/Projects/blob/master/Numbers/pi.py ''' | |
import math | |
def once_upon_a_time(and_, in_a_village): | |
there_was_a_witch = 10 ** 16 | |
who_hid_her_true_nature = float((and_ * there_was_a_witch) // in_a_village) / \ | |
there_was_a_witch | |
and_the_birds = (int(there_was_a_witch * math.sqrt(who_hid_her_true_nature)) * in_a_village) // \ | |
there_was_a_witch |
- http://stackoverflow.com/questions/804115 (
rebase
vsmerge
). - https://www.atlassian.com/git/tutorials/merging-vs-rebasing (
rebase
vsmerge
) - https://www.atlassian.com/git/tutorials/undoing-changes/ (
reset
vscheckout
vsrevert
) - http://stackoverflow.com/questions/2221658 (HEAD^ vs HEAD~) (See
git rev-parse
) - http://stackoverflow.com/questions/292357 (
pull
vsfetch
) - http://stackoverflow.com/questions/39651 (
stash
vsbranch
) - http://stackoverflow.com/questions/8358035 (
reset
vscheckout
vsrevert
)
#!/bin/sh | |
echo "data:"`file --mime-type -b $1`";base64," | |
cat $1 | openssl base64 |
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
###The Issue With Forever Forever is great for running node services, with a minor setback: the word "forever" doesn't apply to system reboots.
###The solution, run node apps as a system service logged in as root
vim /etc/init/node-app.conf
Contents for node-app.conf