-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspeed-estimation.html
84 lines (79 loc) · 14.1 KB
/
speed-estimation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en" class="light-mode">
<head>
<meta charset="utf-8" />
<link rel="icon" href="./favicon.png" />
<link rel="stylesheet" type="text/css" href="./site.css" />
<meta name="viewport" content="width=device-width" />
<link href="./_app/immutable/assets/3.84abd576.css" rel="stylesheet">
<link href="./_app/immutable/assets/sterling.ba12fde9.css" rel="stylesheet">
<link href="./_app/immutable/assets/Header.9b742ac5.css" rel="stylesheet">
<link href="./_app/immutable/assets/Post.a1c147c5.css" rel="stylesheet">
<link rel="modulepreload" href="./_app/immutable/entry/start.2c55a661.js">
<link rel="modulepreload" href="./_app/immutable/chunks/scheduler.75f5293f.js">
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.74c6a932.js">
<link rel="modulepreload" href="./_app/immutable/chunks/paths.21152387.js">
<link rel="modulepreload" href="./_app/immutable/entry/app.4df5770f.js">
<link rel="modulepreload" href="./_app/immutable/chunks/index.36074062.js">
<link rel="modulepreload" href="./_app/immutable/nodes/0.1375ff03.js">
<link rel="modulepreload" href="./_app/immutable/nodes/3.b744dd68.js">
<link rel="modulepreload" href="./_app/immutable/chunks/each.e59479a4.js">
<link rel="modulepreload" href="./_app/immutable/chunks/spread.8a54911c.js">
<link rel="modulepreload" href="./_app/immutable/chunks/Button.fb729d6d.js">
<link rel="modulepreload" href="./_app/immutable/chunks/Header.5ff96dfd.js">
<link rel="modulepreload" href="./_app/immutable/nodes/10.8281a622.js">
<link rel="modulepreload" href="./_app/immutable/chunks/Post.19bcd7ab.js">
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents"> <div class="root"><div class="header svelte-7d51k5"><a href="/" class="svelte-7d51k5" data-svelte-h="svelte-bk6u5r">geoffcox.github.io</a><span class="logo svelte-7d51k5" role="button" tabindex="-1"><svg fill="#000000" height="60px" width="60px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 364.6 364.6" xml:space="preserve" class="rooster"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M349.671,84.233c-0.524-0.569-1.075-1.168-1.569-1.717c2.237,0.851,3.904,1.238,5.27,1.238c5.044,0,5.044-5.465,5.044-7.261 c0-9.283-28.466-19.16-67.687-23.483c-2.576-0.284-5.181-0.428-7.742-0.428c-35.789,0-60.558,27.861-69.882,38.35 c-0.808,0.908-1.509,1.696-2.1,2.337c-4.938,5.351-14.347,22.911-21.907,37.021c-3.967,7.404-8.065,15.055-9.063,16.136 c-0.111,0.021-0.359,0.051-0.841,0.051c-5.586,0-26.424-3.901-42.477-13.117c-10.866-6.238-17.003-20.129-24.109-36.213 c-4.405-9.973-9.398-21.275-16.155-31.93C84.497,46.365,67.24,37.43,58.946,33.135c-1.8-0.932-3.65-1.89-4.453-2.478 c6.758-4.103,17.769-11.838,19.395-19.5c0.291-1.375,0.131-2.452-0.478-3.204c-0.572-0.705-1.479-1.063-2.699-1.063 c-2.959,0-7.624,2.115-11.372,3.814c-0.922,0.418-1.968,0.892-2.809,1.24c0.472-0.636,1.065-1.378,1.563-2.001 c2.897-3.624,4.918-6.337,4.527-8.25c-0.128-0.628-0.501-1.125-1.08-1.437C61.223,0.087,60.863,0,60.471,0 c-2.384,0-5.873,3.325-10.543,8.022c-1.359,1.369-2.965,2.983-3.982,3.822c0.15-0.709,0.427-1.639,0.638-2.346 c0.828-2.78,1.685-5.656,0.448-7.315c-0.371-0.497-1.1-1.089-2.47-1.089c-2.804,0-5.262,4.723-8.43,11.395 c-0.787,1.659-1.729,3.645-2.321,4.567c-0.264-0.79-0.498-2.28-0.665-3.347c-0.539-3.44-1.049-6.69-3.335-6.69 c-2.086,0-3.271,3.45-5.029,9.081c-0.661,2.117-1.643,5.258-2.251,5.995c-0.654-0.296-2.047-2.061-2.901-3.143 c-1.778-2.252-3.313-4.197-4.924-4.197c-0.097,0-0.193,0.008-0.287,0.021c-1.903,0.287-1.866,2.942-1.818,6.305 c0.021,1.531,0.072,5.116-0.569,5.413c-0.201,0.023-0.385,0.034-0.554,0.034c-0.943,0-1.246-0.332-1.797-0.936 c-0.385-0.423-0.865-0.948-1.618-1.342c-1.113-0.58-2.172-0.434-2.897,0.357c-1.815,1.976-1.456,7.887-0.649,17.388 c0.183,2.148,0.355,4.179,0.466,6.025c0.241,4.029,1.662,6.845,4.219,8.422c-0.634,1.926-1.371,4.466-1.786,6.931 c-0.497,2.955-0.455,6.83,0.48,7.937c0.249,0.295,0.583,0.458,0.941,0.458c0.296,0,0.845-0.115,1.216-0.886 c1.458-3.032,3.256-4.274,5.135-4.924c-1.195,1.803-0.871,4.601-0.328,9.073c0.289,2.383,0.648,5.348,0.864,8.906 c0.716,11.827,7.892,15.414,10.956,16.945c0.241,0.121,0.38,0.24,0.412,0.354c0.202,0.734-1.237,2.986-2.904,5.595 c-2.024,3.165-4.796,7.501-7.901,13.712c-6.952,13.903-9.06,38.213-5.637,65.027c2.641,20.684,45.074,63.002,67.87,85.737 c3.745,3.734,6.979,6.959,9.447,9.498c1.416,1.457,2.833,2.774,4.251,3.968c-10.165,17.899-22.385,39.167-23.505,40.395 c-0.021,0.018-0.088,0.037-0.207,0.037c-0.666,0-1.888-0.553-3.07-1.086c-1.362-0.616-2.906-1.313-4.461-1.629 c-0.77-0.155-1.367-0.231-1.825-0.231c-1.219,0-1.571,0.621-1.673,0.991c-0.229,0.84-0.011,1.73,4.705,4.614 c-1.799,0.563-5.492,1.281-8.354,1.838c-4.659,0.906-9.476,1.844-12.081,2.884c-7.437,2.97-8.148,3.821-7.934,4.939 c0.227,1.181,1.786,1.181,2.535,1.181c1.264,0,3.195-0.183,5.907-0.56c10.367-1.439,12.919-1.469,16.123-1.412 c0.405,0.007,0.823,0.014,1.276,0.019c-0.185,0.133-0.375,0.268-0.559,0.398c-2.931,2.086-7.836,5.577-9.284,10.881 c-0.221,0.811-0.292,1.449,0.078,1.935c0.22,0.287,0.557,0.452,0.924,0.452c0.713,0,1.335-0.572,2.697-1.828 c1.137-1.048,2.551-2.351,4.04-3.269c2.957-1.821,17.219-8.893,20.895-9.417c0.3-0.043,0.616-0.064,0.94-0.064 c1.787,0,3.636,0.631,5.424,1.242c1.587,0.542,3.085,1.054,4.414,1.054c0.945,0,1.3-0.5,1.427-0.799 c0.432-1.013-0.475-1.957-2.282-3.839c-1.845-1.921-4.634-4.825-4.634-6.903c0-0.783,1.143-3.177,3.018-6.572 c2.934-0.357,6.478-1.351,9.902-3.741c3.853-2.69,4.371-3.56,4.078-4.491c-0.108-0.345-0.455-0.922-1.563-0.922 c-1.069,0-2.974,0.503-4.989,1.036l-1.139,0.3c-0.591,0.153-1.23,0.23-1.897,0.233c3.726-6.233,8.396-13.697,12.912-20.757 c2.767,0.918,5.567,1.385,8.419,1.385c3.708,0,7.175-0.775,10.363-1.858c-0.315,20.359-1.176,49.446-2.416,54.679 c-0.324-0.225-0.715-0.509-1.06-0.76c-2.07-1.507-4.905-3.569-7.148-3.7c-0.458,0-0.848,0.251-1.017,0.653 c-0.31,0.738,0.183,1.238,1.075,2.146c0.387,0.394,1.32,1.343,1.625,1.893c-0.37,0.065-1.325,0.05-2.537-0.139 c-1.356-0.211-2.93-0.318-4.675-0.318c-7.323,0-16.181,1.869-19.515,2.573c-0.403,0.085-0.729,0.153-0.966,0.2 c-0.961,0.192-1.427,0.632-1.385,1.308c0.063,0.986,0.091,1.434,10.187,2.517c4.865,0.522,10.841,1.022,14.605,1.291 c2.3,0.165,3.477,0.396,4.067,0.578c-0.531,0.298-1.6,0.75-3.711,1.353c-6.104,1.745-11.008,5.027-13.161,7.547 c-0.457,0.535-0.306,0.942-0.22,1.129l0.332,0.436h0.64c0.42,0,0.927-0.041,2.621-0.771c1.789-0.772,4.238-1.659,6.659-2.372 c4.001-1.176,9.112-2.501,16.691-3.41c4.653-0.559,6.114-1.743,7.18-2.607c0.559-0.453,0.84-0.681,1.497-0.754 c1.054-0.111,3.06,0.806,4.827,1.602c2.089,0.939,4.074,1.804,5.403,1.642c0.652-0.081,1.142-0.447,1.341-1.003 c0.497-1.385-0.627-3.545-8.151-11.512c-0.75-0.795-1.209-3.509-1.449-7.48c2.664-1.178,5.814-3.163,8.433-6.516 c2.761-3.533,3.061-4.534,2.672-5.333c-0.213-0.436-0.651-0.695-1.175-0.695c-0.965,0-2.505,0.929-5.143,2.569l-1.006,0.623 c-1.089,0.67-2.434,1.062-3.99,1.195c-0.009-12.937,1.087-31.368,2.285-45.899c2.104-2.244,3.859-4.994,5.577-7.693 c3.39-5.324,6.591-10.354,11.878-10.354c0.897,0,1.858,0.143,2.856,0.426c2.583,0.733,5.126,1.074,8.002,1.074 c1.813,0,3.569-0.128,5.43-0.264c2.003-0.146,4.073-0.296,6.374-0.296c5.411,0,10.76,0.894,16.833,2.811 c3.388,1.07,6.264,1.613,8.547,1.613c4.068,0,5.682-1.732,6.318-3.186c2.022-4.611-2.741-12.209-7.873-17.781 c-6.116-6.642-10.65-10.962-13.65-13.821c-1.471-1.401-2.792-2.66-3.436-3.408c0.581-0.023,1.651,0.003,2.947,0.048 c1.403,0.048,3.149,0.108,5.243,0.108c10.033,0,20.363-1.454,31.581-4.446c7.002-1.866,8.352-3.872,12.358-9.825 c0.542-0.806,1.136-1.688,1.804-2.659c1.619-2.355,2.551-3.85,3.168-4.839c0.951-1.526,0.951-1.526,1.855-1.813 c0.384-0.121,0.88-0.279,1.554-0.531c1.459-0.548,3.386-0.882,5.427-1.235c3.463-0.601,7.388-1.28,10.846-3.226 c2.294-1.291,4.201-1.455,5.885-1.601c2.126-0.183,4.134-0.356,5.846-2.711c1.274-1.751,1.482-3.768,1.667-5.547 c0.264-2.554,0.495-3.913,2.498-4.484c1.385-0.396,2.275-1.009,2.724-1.874c0.727-1.404,0.146-3.064-0.59-5.166 c-0.518-1.479-1.104-3.155-1.421-5.155c-0.521-3.302,0.17-3.72,2.457-5.105c1.444-0.875,3.423-2.073,5.674-4.457 c3.969-4.202,2.507-7.133,1.54-9.072c-0.645-1.293-0.849-1.841-0.428-2.473c8.374-12.561,11.613-19.088,12.857-22.352 c1.442-3.786,0.828-6.239,0.179-8.837c-0.623-2.491-1.267-5.067-0.146-9.394c1.463-5.642,0.688-7.66-0.383-10.454 c-0.722-1.879-1.538-4.01-1.939-8.022c-0.489-4.893-4.334-6.726-6.797-7.564c1.216-0.365,2.947-0.851,5.064-1.443 c1.212-0.339,2.597-0.512,4.113-0.512c8.481,0,20.432,5.36,30.976,10.09c9.497,4.26,18.468,8.284,24.323,8.284 c1.525,0,2.831-0.275,3.882-0.817c1.578-0.814,2.518-2.015,2.792-3.567C361.582,97.161,354.414,89.382,349.671,84.233z"></path></g></svg></span> </div> <div class="content-container svelte-5oz901"> <div class="split svelte-5oz901"><div class="nav svelte-5oz901"><div class="nav-header svelte-5oz901" role="separator"></div> <a href="./resume" class="svelte-5oz901">Geoff's Resume</a><div class="nav-header svelte-5oz901" role="separator">Open Source</div> <a href="./binary-search" class="svelte-5oz901">binary-search</a><a href="./recoil-examples" class="svelte-5oz901">recoil-examples</a><a href="./splitters" class="svelte-5oz901">react-splitter / svelte-splitter</a><a href="./sterling-svelte" class="svelte-5oz901">sterling-svelte</a><a href="./trie-search" class="svelte-5oz901">trie-search</a><div class="nav-header svelte-5oz901" role="separator">Opinion</div> <a href="./why-i-love-svelte" class="svelte-5oz901">Why I love Svelte</a><div class="nav-header svelte-5oz901" role="separator">Stories</div> <a href="./unpredictable-users" class="svelte-5oz901">Unpredictable users</a><a href="./speed-estimation" class="svelte-5oz901">Speed Estimation</a><div class="nav-header svelte-5oz901" role="separator">Bookshelf</div> <a href="./software-architecture-books" class="svelte-5oz901">Software Architecture Books</a></div> <div class="content svelte-5oz901"><div class="post svelte-nmvp7s"><div class="category svelte-nmvp7s">Story</div> <div class="headline svelte-nmvp7s"><a href="speed-estimation" class="svelte-nmvp7s">Speed Estimation</a></div> <div class="content-section svelte-nmvp7s"><div class="container svelte-nmvp7s"><div class="content"><p data-svelte-h="svelte-zi2g9c">One evening, when I was working on a large customer data store, there was an emergency team
meeting to figure out how to handle a bug that had incorrectly hashed the Passport
authentication identifiers in our SQL databases. About 20 of us were called into a 10 person
conference room to discuss options.</p> <p data-svelte-h="svelte-139gv2o">A dev on my team reported he had already patched the code and had a SQL script to repair the
existing data. However, some random guy from another team had been talking to my boss and
followed us into the meeting room. He decided to take over the meeting and loudly declared that
we first had to estimate how long running the script would take. My boss, normally outspoken and
decisive, deferred to him. Everyone assumed he must be important and knew what he was doing.</p> <p data-svelte-h="svelte-1qkpabd">He grabbed a whiteboard pen and starting doing a calculation on the board. He stated that
updating a row in SQL probably takes at best 1 millisecond when within a transaction. He also
wrote out a bunch of hash algorithm statements that he said added up to 2.5 milliseconds per
row. We had 400 million rows that needed updating. He then calculated this would take 400
million x 3.5 = 1.4 billion milliseconds => 1.4 million seconds => 23 thousand minutes
=> 388 hours => 16 days.</p> <p data-svelte-h="svelte-11ih7t0">No one could use the system until all the rows were updated. The room was in a panic. I thought
that we should get the script started ASAP. I pulled the dev and a service engineer into the
hallway to confirm they had confidence in the script and to ask them to get it running.</p> <p data-svelte-h="svelte-o6jwum">In the meantime, random guy started drawing up a shift rotation schedule for each person to be
on site watching the script run over the next 16 days. After 15 minutes, as random guy was
finalizing the shift schedule, the dev and service engineer returned. The dev whispered in my
ear the results.</p> <p data-svelte-h="svelte-9eoe3a">Random guy was literally giving a pep talk to the room about how hard it was going to be working
24 hours a day, but that it would be a worthy and valiant effort. I tried to interrupt him, but
he didn't give me any opportunity.</p> <p data-svelte-h="svelte-1j8jwfq">Finally, he finished. I let the room know that we had run the script and it completed in under
15 minutes. The script updated over 400 rows per millisecond. He muttered that was impossible as
his chest caved and he hung his head.</p> <p data-svelte-h="svelte-bcazty">While this guy was a bit of a blow hard, he followed how developers are taught to estimate
algorithms. We mentally walk through the steps, estimate the cost of each instruction, account
for loops, and multiply by the number of items to get the result.</p> <p data-svelte-h="svelte-a3ynid">The problem was that computation speed had exceeded human imagination. It is hard for humans to
understand how fast 1/400th of a millisecond goes by. We like to think we can understand that
kind of processing power, but we can't be precise enough to avoid exponential errors. This was
back in 2005. Today, that script would likely complete in seconds.</p> <p data-svelte-h="svelte-1prs90w">We shouldn't manually think through estimates. Instead, we have to run the code in a
production/test environment and measure the real performance. Don't be that (random) guy.</p></div></div> </div> </div></div></div></div> </div>
<script>
{
__sveltekit_1cy0fcu = {
base: new URL(".", location).pathname.slice(0, -1),
env: {}
};
const element = document.currentScript.parentElement;
const data = [null,null,null];
Promise.all([
import("./_app/immutable/entry/start.2c55a661.js"),
import("./_app/immutable/entry/app.4df5770f.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 3, 10],
data,
form: null,
error: null
});
});
}
</script>
</div>
</body>
</html>