Just curious - Artificial Intelligenece in Compilation

I am just curious. Is it possible to embed Artificial Intelligence inside compiler? So as the program gets executed, the A.I looks at it and optimizes the byte code next time so that every run becomes little more efficient?

Say I code a function add(a, b), as it runs, the A.I will know that a and b are mostly Integer, so with that info it can optimize the byte code. Like strategy algorithm it can pick up the best byte code for given inputs thus making execution faster.

If we can do that, then all scripting languages will become super efficient.

···

--
Karthikeyan A K <karthikeyan@openmailbox.org>

Well , not an "AI" but that's exactly what JIT is for :slight_smile:

···

Sent with AquaMail for Android

On June 10, 2017 10:59:11 AM Karthikeyan A K <karthikeyan@openmailbox.org> wrote:

I am just curious. Is it possible to embed Artificial Intelligence inside compiler? So as the program gets executed, the A.I looks at it and optimizes the byte code next time so that every run becomes little more efficient?

Say I code a function add(a, b), as it runs, the A.I will know that a and b are mostly Integer, so with that info it can optimize the byte code. Like strategy algorithm it can pick up the best byte code for given inputs thus making execution faster.

If we can do that, then all scripting languages will become super efficient.

--
Karthikeyan A K <karthikeyan@openmailbox.org>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

This email message and all attached files are privileged, subject to international copyright protection and may be confidential. Any unauthorized view, use, disclosure, copying, or distribution is prohibited. The information is intended only for the use of the individual or entity named above, and the Recipient undertakes not to make any use of such information that may constitute a violation of the provisions of the Law. If you have received this communication in error, please notify us immediately and delete the message from your computer. Thank you.

Couple of problems with that — the code that is one devices that gets executed is compiled. To make changes to how it’s organized, you would need one of two things — #1 Change to the uncompiled source code or #2 a program that optimizes the compilation in a way that is able to demonstrate better functionality.

Apple has hired pretty huge teams to do the latter — optimizing the code that gets put on the SOC (system on a chip) devices, such as the iPad, iPhone, Apple Watch, etc.

It’s incredibly difficult work to do, even when you’re on massive computers. I they were to embark on something like this, it would be done by the coding teams, it wouldn’t be done on the fly on devices.

Hope this helps.

Kirk

···

On Jun 10, 2017, at 2:58 AM, Karthikeyan A K <karthikeyan@openmailbox.org> wrote:

I am just curious. Is it possible to embed Artificial Intelligence inside compiler? So as the program gets executed, the A.I looks at it and optimizes the byte code next time so that every run becomes little more efficient?

Say I code a function add(a, b), as it runs, the A.I will know that a and b are mostly Integer, so with that info it can optimize the byte code. Like strategy algorithm it can pick up the best byte code for given inputs thus making execution faster.

If we can do that, then all scripting languages will become super efficient.

--
Karthikeyan A K <karthikeyan@openmailbox.org>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

I am just curious. Is it possible to embed Artificial Intelligence inside compiler? So as the program gets executed, the A.I looks at it and optimizes the byte code next time so that every run becomes little more efficient?

Say I code a function add(a, b), as it runs, the A.I will know that a and b are mostly Integer, so with that info it can optimize the byte code. Like strategy algorithm it can pick up the best byte code for given inputs thus making execution faster.

If we can do that, then all scripting languages will become super efficient.

yes. however...

assuming that:

* programs cannot take forever to run
* there is a maximum size that a program can have

and that there are programs `x` and `y` and optimizer `f`, such that

  y = f(x)

so that `y` is teh optimized version of `x`.

you can write `f` yourself or kindly ask teh computer to write it for
you.

if you ask it, then an AI is a function `g` of some magic `z`, such that

  g(z) = f

and asking teh machine to guess `f` is teh same thing as asking for it
to evaluate `g(z)`.

this is nice because you could just swap teh value of `z` to ask for
optimized versions of other values of `x`.

now you have to decide wat this magic `z` will be, it could be
programming language for example, and write `g`. but luckily, for any
magic you may think of, because programs have max size and cannot take
forever to run, you can simply brute force characters and try out all
possible programs...

this is obviously slow and then you think about _optimizing_ this AI and
then you notice that _optimiception_...

now wat if instead you just write a fast `h` such that

  h(z, x) = g(z)(x) = y

you could call `u = (z, x)`, and then

  h(u) = y

teh thing to notice is that teh set of `u` is bigger than teh set of
`x`, therefore teh problem may be (considerably) harder, and we dont
even want `y`! in fact, wat we really just want from teh beginning is
some `w` for a given `v` such that

  w = x(v)

and that solves some kind of real problem and we want it fast. whether
there is `y`, `g` or `h`, we dont care.

so if you want fast code, write C, if you want to code fast, write ruby,
if you dont want to code, write an stupid AI to do it for you and toss
insane amounts of CPU so that it becomes faster than humans and we dont
have to think anymoar and become zombies and live forever enslaved by
machines inside teh matrix we built ourselves.

this is wat i would expect in a near future.

<3

···

--
dota? =op

[snip]

Wonderful math exercise!

if you dont want to code, write an stupid AI to do it for you and toss
insane amounts of CPU so that it becomes faster than humans and we dont
have to think anymoar and become zombies and live forever enslaved by
machines inside teh matrix we built ourselves.

this is wat i would expect in a near future.

That reminded of Homo Deus - Yuval Noah Harari A book
worthwhile to read - even if one does not subscribe to his bleak
vision for the future.

Kind regards

robert

···

On Tue, Jun 13, 2017 at 8:47 PM, Igor Fontana <rogi@skylittlesystem.org> wrote:

--
[guy, jim, charlie].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/

so if you want fast code, write C, if you want to code fast, write ruby,
if you dont want to code, write an stupid AI to do it for you and toss
insane amounts of CPU so that it becomes faster than humans and we dont
have to think anymoar and become zombies and live forever enslaved by
machines inside teh matrix we built ourselves.

The sweet premise of so many Sci-Fi works.