on inherent complexity of computation, by attila szegedi

106
On Inherent Complexity of Computation Attila Szegedi @asz

Upload: zeroturnaround

Post on 09-May-2015

756 views

Category:

Technology


0 download

DESCRIPTION

The system you just recently deployed is likely an application processing some data, likely relying on some configuration, maybe using some plugins, certainly relying on some libraries, using services of an operating system running on some physical hardware. The previous sentence names 7 categories into which we compartmentalise various parts of a computation process that’s in the end going on in a physical world. Where do you draw the line of functionality between categories? From what vantage points do these distinctions become blurry? Finally, how does it all interact with the actual physical world in which the computation takes place? (What is the necessary physical minimum required to perform a computation, anyway?) Let’s make a journey from your AOP-assembled, plugin-injected, YAML-configured, JIT compiled, Hotspot-executed, Linux-on-x86 hosted Java application server talking JSON-over-HTTP-over-TCP-over-IP-over-Ethernet all the way down to electrons. And then back. Recorded at GeekOut 2013.

TRANSCRIPT

Page 1: On Inherent Complexity of Computation, by Attila Szegedi

On Inherent Complexity of Computation

Attila Szegedi@asz

Page 2: On Inherent Complexity of Computation, by Attila Szegedi

THE FOLLOWING IS INTENDED TO OUTLINE OUR GENERAL PRODUCT DIRECTION. FOR INFORMATION PURPOSES ONLY, AND MAY NOT BE INCORPORATED INTO ANY CONTRACT. IT IS NOT A COMMITMENT TO DELIVER ANY MATERIAL, CODE, OR FUNCTIONALITY, AND SHOULD NOT BE RELIED UPON IN MAKING PURCHASING DECISION. THE DEVELOPMENT, RELEASE, AND TIMING OF ANY FEATURES OR FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS REMAINS AT THE SOLE DISCRETION OF ORACLE.

Page 3: On Inherent Complexity of Computation, by Attila Szegedi
Page 4: On Inherent Complexity of Computation, by Attila Szegedi

I won’t tell you anything humankind doesn’t already

know for 40 years.

Page 5: On Inherent Complexity of Computation, by Attila Szegedi

I won’t tell you anything humankind doesn’t already

know for 40 years.

Page 6: On Inherent Complexity of Computation, by Attila Szegedi

I won’t tell you anything humankind doesn’t already

know for 40 years.

This is not a Lisp talk.

Page 7: On Inherent Complexity of Computation, by Attila Szegedi

I won’t tell you anything humankind doesn’t already

know for 40 years.

This is not a Lisp talk. No, seriously.

Page 8: On Inherent Complexity of Computation, by Attila Szegedi

How complex is your system?

Page 9: On Inherent Complexity of Computation, by Attila Szegedi

Is it this?

Hardware

Operating system

Application

Configuration

Persistent data

Runtime state

Page 10: On Inherent Complexity of Computation, by Attila Szegedi

Is it maybe more like this?

Hardware

HypervisorOperating systemVirtual machine

Application serverApplication

Plugins

ConfigurationPersistent data

Runtime state

Page 11: On Inherent Complexity of Computation, by Attila Szegedi

Hardware

HypervisorOperating systemVirtual machine

Application serverApplication

Plugins

ConfigurationPersistent data

Runtime state

Electricity

Electric impulses on a wire

Heat

Page 12: On Inherent Complexity of Computation, by Attila Szegedi

The electricity to heat part is easy.

Page 13: On Inherent Complexity of Computation, by Attila Szegedi

100011110001011010100100000101111100000100100010101001010100101000010111111000110111011000110101010

1001000101010010101001010000101111110001101110110001100000110011110000110001100000100110111011111110110110010111001001000001010000110010111100101101101110000111011101100101110111011101001101100111100110101000011110111111011101110100110010111011101110100101101100110011001011101110110011111101001101000111010100000110000101010001001100001111010011001011110101000001010100110100011101011011001000001100001100101000001001101110000111110011000001100101100001100011100111000001100001110011110101100011100111110101100101100111000001000111100110110101001010101001111001011110010111011011001011110010111010100000100000111100001100001110001111010001100101101111110010101110110010101110110001110111100000101000101010111000101110101110111011101001110101101001101010110001011011010000110111111101111100101111001011001011100100101101100001011110011110101000001010000100100010100001011111101011011101100111011101101011011011100011110101110001011101011101110111010011101011101111011101100011100011010101100010110110100001101001110111011001111100010110000111000111101011111010100000110100011101001110100111000011101010111110111111001111100101110010111010111101111111010111101001011101100101110010110111111110001101101110110011100101110000110001110111011100001101000111000010101001100110111111000111100001111010011010011101111110111011101010000011010001110100111010011100001110101011111011111100111110010111001011101011110111111101011110100101110110010111001011011111010100001111000011100011110100011001011011011000011110111111011101110100111001011011111101100111010100000110110111000011111000101101110000111001111100101111101110011110000110000101010001011111000111000011010011110010110010111100111110101000001010100110100011101011011001000001100001100101000001001101110000111110011000001100101100001100011100111000001100001110011110101100011110001110101100101100111000001000111100110110101001010101011011000011110010111100111101010000010000011100011110001111001011110000111010010110110001011101110110001111011111100100110100111011101100111101010000111101111110111011011101100101110001111101001101001110111111011101110101000001100011110110011011111110011110010110101000011110111111011101110100110010111011101110100101101101010011110011110000110010111101010000011101001100101111100011101001011111101000111010011011011101100111011100000110001111010001100001111001011100111100101111010011110110101011010100100011010110111100010101010

Page 14: On Inherent Complexity of Computation, by Attila Szegedi

GET / HTTP/1.1

HTTP/1.1 301 Moved PermanentlyContent-Length: 0Date: Thu, 02 May 2013 09:13:23 GMTServer: Apache/2.2.17 (Ubuntu)X-Powered-By: PHP/5.3.5-1ubuntu7.11X-Pingback: http://geekout.ee/xmlrpc.phpLocation: http://geekout.ee/Cache-Control: max-age=300Expires: Thu, 02 May 2013 09:18:23 GMTVary: Accept-EncodingConnection: closeContent-Type: text/html; charset=UTF-8

Page 15: On Inherent Complexity of Computation, by Attila Szegedi

GET / HTTP/1.1

HTTP/1.1 301 Moved PermanentlyContent-Length: 0Date: Thu, 02 May 2013 09:13:23 GMTServer: Apache/2.2.17 (Ubuntu)X-Powered-By: PHP/5.3.5-1ubuntu7.11X-Pingback: http://geekout.ee/xmlrpc.phpLocation: http://geekout.ee/Cache-Control: max-age=300Expires: Thu, 02 May 2013 09:18:23 GMTVary: Accept-EncodingConnection: closeContent-Type: text/html; charset=UTF-8

Hardware

HypervisorOperating systemVirtual machine

Application serverApplication

Plugins

ConfigurationPersistent data

Runtime state

Page 16: On Inherent Complexity of Computation, by Attila Szegedi

Hardware

HypervisorOperating systemVirtual machine

Application serverApplication

Plugins

ConfigurationPersistent data

Runtime stateC

ompl

exity

Abs

trac

tion

Page 17: On Inherent Complexity of Computation, by Attila Szegedi

How many layers are there? Are they

inherent? Are they real?

Page 18: On Inherent Complexity of Computation, by Attila Szegedi

Hardware

HypervisorOperating systemVirtual machine

Application serverApplication

Plugins

ConfigurationPersistent data

Runtime state

Page 19: On Inherent Complexity of Computation, by Attila Szegedi

Hardware

Operating systemVirtual machine

Application

A virtual machine takes bytecode and transforms it into something resembling a native application on the OS/hardware.

Page 20: On Inherent Complexity of Computation, by Attila Szegedi

Hardware

Virtual machine

Application

Then there are some attempts to even eliminate the operating system.

Page 21: On Inherent Complexity of Computation, by Attila Szegedi

Hardware

And some to go all the way down to

Page 22: On Inherent Complexity of Computation, by Attila Szegedi

BitCoin craze

MHash/J

Generic CPU 0.1-1.14

GPU 2.4

FPGA 25

ASIC 160

https://en.bitcoin.it/wiki/Mining_hardware_comparison

Page 23: On Inherent Complexity of Computation, by Attila Szegedi

BitCoin craze

MHash/J

Generic CPU 0.1-1.14

GPU 2.4

FPGA 25

ASIC 160

https://en.bitcoin.it/wiki/Mining_hardware_comparison

Page 24: On Inherent Complexity of Computation, by Attila Szegedi

These are actual products

Page 25: On Inherent Complexity of Computation, by Attila Szegedi

Hardware

HypervisorOperating systemVirtual machine

Application serverApplication

Plugins

ConfigurationPersistent data

Runtime state

Page 26: On Inherent Complexity of Computation, by Attila Szegedi

Application

Configuration

In languages where code is first-class data, you don’t have to distinguish between the two.

Page 27: On Inherent Complexity of Computation, by Attila Szegedi

Application = Configuration

• In Lua, recommended data serialization format is Lua source code.

• You can just eval() JSON in JavaScript.

• Lisp. ‘nuff said.

• Standard disclaimer about having your program execute unverified external code.

Page 28: On Inherent Complexity of Computation, by Attila Szegedi

No, seriously, what is computation?

Page 29: On Inherent Complexity of Computation, by Attila Szegedi

Computation is a transition from a more

likely to a less likely state.

(Decrease in physical entropy; increase in information entropy.)

Page 30: On Inherent Complexity of Computation, by Attila Szegedi

Wait what?• In information theory, entropy is the

measure of uncertainty of state.

• In physics, it’s the amount of missing information to precisely describe the state of the system.

• The two usages of the term are therefore exactly opposite.

• Way to troll each other, fellow scientists!

Page 31: On Inherent Complexity of Computation, by Attila Szegedi

This is very likely This is highly unlikely

Page 32: On Inherent Complexity of Computation, by Attila Szegedi

This is very likely

•An empty database•An uninitialized disk•RAM when power is turned on

•Quiet network

Page 33: On Inherent Complexity of Computation, by Attila Szegedi

This is very likely This is highly unlikely

Page 34: On Inherent Complexity of Computation, by Attila Szegedi

This is highly unlikely

•A populated database•A populated disk•RAM after substantial activity

•Active network

Page 35: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Having an ongoing record of people’s thoughts and events persisted in a social network database is less likely than not having them.

• Just think about the combined effort of creating Twitter/Facebook/etc databases

• both people building and operating it, and

• people pouring data into it.

Page 36: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

Page 37: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Thinking of boundaries of identities in real world can be quite fascinating.

Page 38: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Thinking of boundaries of identities in real world can be quite fascinating.

• Where does a computer end?

Page 39: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Thinking of boundaries of identities in real world can be quite fascinating.

• Where does a computer end?

• Where does a person end?

Page 40: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Thinking of boundaries of identities in real world can be quite fascinating.

• Where does a computer end?

• Where does a person end?

• Can we influence another person in such a way that part of us actually lives in them?

Page 41: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

Page 42: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Where does a computer end?

Page 43: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Where does a computer end?

• Where does a person end?

Page 44: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Where does a computer end?

• Where does a person end?

• Can we influence another person in such a way that part of us actually lives in them?

Page 45: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

Page 46: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Where does a computer end?

Page 47: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Where does a computer end?

• Where does a person end?

Page 48: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

• Where does a computer end?

• Where does a person end?

• Can we influence another person in such a way that part of us actually lives in them?

Page 49: On Inherent Complexity of Computation, by Attila Szegedi

Humans are part of the computation

Page 50: On Inherent Complexity of Computation, by Attila Szegedi

Arrow of time

• Transitioning from more likely to less likely gives us an arrow of time.

• We naturally presume that more likely states precede less likely ones.

• Opposite cases happen, and they are associated with idea of destruction.

Page 51: On Inherent Complexity of Computation, by Attila Szegedi

Is unzip not a computation then?

• It creates more likely (decompressed) from less likely (compressed) data!

• It is still a computation, though.

Page 52: On Inherent Complexity of Computation, by Attila Szegedi

Is unzip not a computation then?

• You started with not having both the compressed and decompressed data, and you end up with both.

• That’s less likely than just having the compressed data.

Page 53: On Inherent Complexity of Computation, by Attila Szegedi

Arrow of time revisited

• Future is a quantum superposition of all possible successive quantum states.

• Past, too, is a quantum superposition of all possible preceding quantum states.

• See Wheeler’s Delayed Choice Experiment.

Page 54: On Inherent Complexity of Computation, by Attila Szegedi

This seemed like a good time for this slide

Page 55: On Inherent Complexity of Computation, by Attila Szegedi

Thermodynamics in the way

• Any physical process that dissipates heat will be irreversible.

• It’s possible to go:

• fast, hot and irreversible, or

• slow, cool, and reversible.

• (And any shade of gray in between.)

Page 56: On Inherent Complexity of Computation, by Attila Szegedi

Thermodynamics in the way

• e x t = const

• e := energy dissipation in form of heat

• t := time to operate an electric circuit

• Going slow conserves energy

Page 57: On Inherent Complexity of Computation, by Attila Szegedi

Why does the arrow of time matter anyway?

Page 58: On Inherent Complexity of Computation, by Attila Szegedi

Here’s why

Page 59: On Inherent Complexity of Computation, by Attila Szegedi

Here’s why

A

BA NAND B

Page 60: On Inherent Complexity of Computation, by Attila Szegedi

Here’s why

A

BA NAND B

Direction

Page 61: On Inherent Complexity of Computation, by Attila Szegedi

Reversible gate

A

B

A NAND B

Direction

reversing bit

Page 62: On Inherent Complexity of Computation, by Attila Szegedi

Reversible gate

A

B

A NAND B

Direction

reversing bit

Page 63: On Inherent Complexity of Computation, by Attila Szegedi

Meandering. Not caring which way it flows.

Page 64: On Inherent Complexity of Computation, by Attila Szegedi

Running analogy

Tempo

Endurance Distance

Page 65: On Inherent Complexity of Computation, by Attila Szegedi

Running analogy

Speed

Powerconsumption

Battery life

Page 66: On Inherent Complexity of Computation, by Attila Szegedi

How fast can we go?

Page 67: On Inherent Complexity of Computation, by Attila Szegedi

How fast can we go?

• I couldn’t figure out hard data for this…

Page 68: On Inherent Complexity of Computation, by Attila Szegedi

How fast can we go?

• I couldn’t figure out hard data for this…

• Theoretical upper limit: divide highest power density with lowest energy for a physical state transition; you get “operations/m3/s”.

Page 69: On Inherent Complexity of Computation, by Attila Szegedi

How fast can we go?

• I couldn’t figure out hard data for this…

• Theoretical upper limit: divide highest power density with lowest energy for a physical state transition; you get “operations/m3/s”.

• Problem with:

Page 70: On Inherent Complexity of Computation, by Attila Szegedi

How fast can we go?

• I couldn’t figure out hard data for this…

• Theoretical upper limit: divide highest power density with lowest energy for a physical state transition; you get “operations/m3/s”.

• Problem with:

• relativistic effects

Page 71: On Inherent Complexity of Computation, by Attila Szegedi

How fast can we go?

• I couldn’t figure out hard data for this…

• Theoretical upper limit: divide highest power density with lowest energy for a physical state transition; you get “operations/m3/s”.

• Problem with:

• relativistic effects

• controlling those amounts of energy output

Page 72: On Inherent Complexity of Computation, by Attila Szegedi

Where are we?

• We could go much hotter and faster.

• Insert science fiction of atomic particle machines that can run few hours of subjective human brain simulation in few femtoseconds before heat-disintegrating.

• We could also go much slower and cooler

• Ain’t nobody got time for that!

Page 73: On Inherent Complexity of Computation, by Attila Szegedi

100011110001011010100100000101111100000100100010101001010100101000010111111000110111011000110101010

1001000101010010101001010000101111110001101110110001100000110011110000110001100000100110111011111110110110010111001001000001010000110010111100101101101110000111011101100101110111011101001101100111100110101000011110111111011101110100110010111011101110100101101100110011001011101110110011111101001101000111010100000110000101010001001100001111010011001011110101000001010100110100011101011011001000001100001100101000001001101110000111110011000001100101100001100011100111000001100001110011110101100011100111110101100101100111000001000111100110110101001010101001111001011110010111011011001011110010111010100000100000111100001100001110001111010001100101101111110010101110110010101110110001110111100000101000101010111000101110101110111011101001110101101001101010110001011011010000110111111101111100101111001011001011100100101101100001011110011110101000001010000100100010100001011111101011011101100111011101101011011011100011110101110001011101011101110111010011101011101111011101100011100011010101100010110110100001101001110111011001111100010110000111000111101011111010100000110100011101001110100111000011101010111110111111001111100101110010111010111101111111010111101001011101100101110010110111111110001101101110110011100101110000110001110111011100001101000111000010101001100110111111000111100001111010011010011101111110111011101010000011010001110100111010011100001110101011111011111100111110010111001011101011110111111101011110100101110110010111001011011111010100001111000011100011110100011001011011011000011110111111011101110100111001011011111101100111010100000110110111000011111000101101110000111001111100101111101110011110000110000101010001011111000111000011010011110010110010111100111110101000001010100110100011101011011001000001100001100101000001001101110000111110011000001100101100001100011100111000001100001110011110101100011110001110101100101100111000001000111100110110101001010101011011000011110010111100111101010000010000011100011110001111001011110000111010010110110001011101110110001111011111100100110100111011101100111101010000111101111110111011011101100101110001111101001101001110111111011101110101000001100011110110011011111110011110010110101000011110111111011101110100110010111011101110100101101101010011110011110000110010111101010000011101001100101111100011101001011111101000111010011011011101100111011100000110001111010001100001111001011100111100101111010011110110101011010100100011010110111100010101010

This is digital computation

Page 74: On Inherent Complexity of Computation, by Attila Szegedi

Digital computation

• Binary inputs go in, binary output goes out

• Not all of the input precedes the output (think streams).

• Later input can be shaped by earlier output (client resubmits a cookie received from server)

Page 75: On Inherent Complexity of Computation, by Attila Szegedi

Digital computation

• A particular computation (or “program”) is mapping of all possible inputs to all possible outputs.

Page 76: On Inherent Complexity of Computation, by Attila Szegedi
Page 77: On Inherent Complexity of Computation, by Attila Szegedi
Page 78: On Inherent Complexity of Computation, by Attila Szegedi

“” -> “10001111000101101010010000010111110000010010001010100101010010100”“0” -> “0100010101100101110110110101101”“1” -> “010001010110100000010001010111110010101000011100101”“01” -> “111100010110101001000001011111000001001000101010010101001010”...

• We don’t write programs this way. Right?

• We recognize patterns and map classes of inputs to classes of outputs.

• It’s basically a compressed representation.

• If the number of patterns is not finite, you’re describing a random process.

Page 79: On Inherent Complexity of Computation, by Attila Szegedi

Kolmogorov complexity

• Defined for strings.

• The length of a program that produces the given string.

• The programming language doesn’t matter

• ‘cause you can just prefix your program with an interpreter written in another language, for a constant difference.

• Can also apply to infinite sequences, such as our “enumerate all programs”

Page 80: On Inherent Complexity of Computation, by Attila Szegedi

Inherent complexity of a computation

Page 81: On Inherent Complexity of Computation, by Attila Szegedi

Inherent complexity of a computation

Page 82: On Inherent Complexity of Computation, by Attila Szegedi

Inherent complexity of a computation

• Inherent complexity of the computation: the length of the most compact form that can encode its full input-output mapping.

Page 83: On Inherent Complexity of Computation, by Attila Szegedi

Inherent complexity of a computation

• Inherent complexity of the computation: the length of the most compact form that can encode its full input-output mapping.

• Incidentally, a string is “random” if it’s shorter than any program that can generate it.

Page 84: On Inherent Complexity of Computation, by Attila Szegedi
Page 85: On Inherent Complexity of Computation, by Attila Szegedi

• Oh, wait, Kolmogorov complexity is a non-computable function.

Page 86: On Inherent Complexity of Computation, by Attila Szegedi

• Oh, wait, Kolmogorov complexity is a non-computable function.

Page 87: On Inherent Complexity of Computation, by Attila Szegedi

• Oh, wait, Kolmogorov complexity is a non-computable function.

• Consequence: no matter how good your optimizing compiler is, you can never prove that there’s not an even better one.

Page 88: On Inherent Complexity of Computation, by Attila Szegedi

• Oh, wait, Kolmogorov complexity is a non-computable function.

• Consequence: no matter how good your optimizing compiler is, you can never prove that there’s not an even better one.

• a.k.a “Full Employment Theorem” for compiler writers.

Page 89: On Inherent Complexity of Computation, by Attila Szegedi

“” -> 1001000101010010101001010000101111110001101110110001100000110011110000110001100000100110111011111110110110010111001001000001010000110010111100101101101110000111011101100101110111011101001101100111100110101000011110111111011101110100110010111011101110100101101100110011001011101110110011111101001101000111010100000110000101010001001100001111010011001011110101000001010100110100011101011011001000001100001100101000001001101110000111110011000001100101100001100011100111000001100001110011110101100011100111110101100101100111000001000111100110110101001010101001111001011110010111011011001011110010111010100000100000111100001100001110001111010001100101101111110010101110110010101110110001110111100000101000101010111000101110101110111011101001110101101001101010110001011011010000110111111101111100101111001011001011100100101101100001011110011110101000001010000100100010100001011111101011011101100111011101101011011011100011110101110001011101011101110111010011101011101111011101100011100011010101100010110110100001101001110111011001111100010110000111000111101011111010100000110100011101001110100111000011101010111110111111001111100101110010111010111101111111010111101001011101100101110010110111111110001101101110110011100101110000110001110111011100001101000111000010101001100110111111000111100001111010011010011101111110111011101010000011010001110100111010011100001110101011111011111100111110010111001011101011110111111101011110100101110110010111001011011111010100001111000011100011110100011001011011011000011110111111011101110100111001011011111101100111010100000110110111000011111000101101110000111001111100101111101110011110000110000101010001011111000111000011010011110010110010111100111110101000001010100110100011101011011001000001100001100101000001001101110000111110011000001100101100001100011100111000001100001110011110101100011110001110101100101100111000001000111100110110101001010101011011000011110010111100111101010000010000011100011110001111001011110000111010010110110001011101110110001111011111100100110100111011101100111101010000111101111110111011011101100101110001111101001101001110111111011101110101000001100011110110011011111110011110010110101000011110111111011101110100110010111011101110100101101101010011110011110000110010111101010000011101001100101111100011101001011111101000111010011011011101100111011100000110001111010001100001111001011100111100101111010011110110101011010100100011010110111100010101010

You can’t cheat

complexity(input) + complexity(decoder)

Page 90: On Inherent Complexity of Computation, by Attila Szegedi
Page 91: On Inherent Complexity of Computation, by Attila Szegedi

• Sometimes, part of the decoder is external.

Page 92: On Inherent Complexity of Computation, by Attila Szegedi

• Sometimes, part of the decoder is external.

• It can be in your head.

Page 93: On Inherent Complexity of Computation, by Attila Szegedi

• Sometimes, part of the decoder is external.

• It can be in your head.

• Again, human is part of thecomputation.

Page 94: On Inherent Complexity of Computation, by Attila Szegedi

Complex look is sometimes a simple pattern

Page 95: On Inherent Complexity of Computation, by Attila Szegedi

Complex look is sometimes a simple pattern

Page 96: On Inherent Complexity of Computation, by Attila Szegedi

Complex look is sometimes a simple pattern

SzegediButterfly1 {init:  z = #pixelloop:  float x = real(z)  float y = imag(z)  z = sqr(y) - sqrt(abs(x)) +            (sqr(x) - sqrt(abs(y))) * 1i + #pixelbailout:  |z| <= @Bailoutdefault:  param Bailout    caption = "Bailout Value"    default = 127.0  endparam}

Page 97: On Inherent Complexity of Computation, by Attila Szegedi

Complex look is sometimes a simple pattern

Page 98: On Inherent Complexity of Computation, by Attila Szegedi

Complex look is sometimes a simple pattern

Page 99: On Inherent Complexity of Computation, by Attila Szegedi

Complex look is sometimes a simple pattern

SzegediButterfly2 {init:  z = #pixelloop:  float x = real(z)  float y = imag(z)  z = sqr(x) - sqrt(abs(y)) +           (sqr(y) - sqrt(abs(x))) * 1i + #pixelbailout:  |z| <= @Bailoutdefault:  param Bailout    caption = "Bailout Value"    default = 127.0  endparam}

Page 100: On Inherent Complexity of Computation, by Attila Szegedi

Even if you could find the most compact

form…• … you probably wouldn’t want to use it.

• It would be even less humanly maintainable than flipping bits in a zipped source file.

• Ever seen 256-byte 8-bit CPU demos?

Page 101: On Inherent Complexity of Computation, by Attila Szegedi

You can always reduce complexity

• You always have excess complexity in your system.

• It’s worth thinking of how to reduce it.

• Pattern recognition (refactoring).

• Favor environments that don’t force you into artificial layer boundaries. Code is data, data is code.

• Patterns can be more overarching without artificial boundaries.

Page 102: On Inherent Complexity of Computation, by Attila Szegedi

Artificial boundaries hobble you

• Favor environments that don’t force you into artificial layer boundaries. Code is data, data is code.

• Patterns can be more overarching without artificial boundaries.

• Java program loads an XML file containing a flow graph and some embedded JavaScript?

• You have a problem.

Page 103: On Inherent Complexity of Computation, by Attila Szegedi

Take aways

• Be sensible with the effort and the result.

• Don’t overshoot into compact-but-unreadable territory.

• Hitting on the minimally complex representation is as likely as inventing the perpetuum mobile. (Thermodynamics metaphor again.)

Page 104: On Inherent Complexity of Computation, by Attila Szegedi
Page 105: On Inherent Complexity of Computation, by Attila Szegedi
Page 106: On Inherent Complexity of Computation, by Attila Szegedi

Image CreditsSnowy branches: http://www.flickr.com/photos/aeioux/2398264997/XKCD comic: http://xkcd.com/297/Complex gizmo: http://www.flickr.com/photos/michaelheiss/2871996129/Electric heater: http://www.flickr.com/photos/jocelynb/426268348/Layer cake: http://www.flickr.com/photos/julessilver/3259734572Abacus: http://www.flickr.com/photos/skidder/37675092Airplanes: http://www.flickr.com/photos/good_day/198611998/Meandering: http://www.flickr.com/photos/31856336@N03/7831522814/Headphones: http://www.flickr.com/photos/doremigirl/8362322435Kolmogorov Lecture: http://en.wikipedia.org/wiki/File:Kolm_complexity_lect.jpg

All used images are Creative Commons licensed, and used according to their terms of license.