<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Mobile_App_Development_2022W_Lecture_20</id>
	<title>Mobile App Development 2022W Lecture 20 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://homeostasis.scs.carleton.ca/wiki/index.php?action=history&amp;feed=atom&amp;title=Mobile_App_Development_2022W_Lecture_20"/>
	<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Mobile_App_Development_2022W_Lecture_20&amp;action=history"/>
	<updated>2026-04-06T03:23:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://homeostasis.scs.carleton.ca/wiki/index.php?title=Mobile_App_Development_2022W_Lecture_20&amp;diff=23973&amp;oldid=prev</id>
		<title>Soma: Created page with &quot;==Video==  Video from the lecture given on March 30, 2022 is now available: * [https://homeostasis.scs.carleton.ca/~soma/mad-2022w/lectures/comp1601-2022w-lec20-20220330.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/mad-2022w/lectures/comp1601-2022w-lec20-20220330.cc.vtt auto-generated captions] Video is also available through Brightspace (Resources-&gt;Zoom Meetings (Recordings, etc.)-&gt;Cloud Recordings tab).  Note that here you&#039;ll also see chat messages.  ==Notes...&quot;</title>
		<link rel="alternate" type="text/html" href="https://homeostasis.scs.carleton.ca/wiki/index.php?title=Mobile_App_Development_2022W_Lecture_20&amp;diff=23973&amp;oldid=prev"/>
		<updated>2022-03-30T19:37:56Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Video==  Video from the lecture given on March 30, 2022 is now available: * [https://homeostasis.scs.carleton.ca/~soma/mad-2022w/lectures/comp1601-2022w-lec20-20220330.m4v video] * [https://homeostasis.scs.carleton.ca/~soma/mad-2022w/lectures/comp1601-2022w-lec20-20220330.cc.vtt auto-generated captions] Video is also available through Brightspace (Resources-&amp;gt;Zoom Meetings (Recordings, etc.)-&amp;gt;Cloud Recordings tab).  Note that here you&amp;#039;ll also see chat messages.  ==Notes...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Video==&lt;br /&gt;
&lt;br /&gt;
Video from the lecture given on March 30, 2022 is now available:&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/mad-2022w/lectures/comp1601-2022w-lec20-20220330.m4v video]&lt;br /&gt;
* [https://homeostasis.scs.carleton.ca/~soma/mad-2022w/lectures/comp1601-2022w-lec20-20220330.cc.vtt auto-generated captions]&lt;br /&gt;
Video is also available through Brightspace (Resources-&amp;gt;Zoom Meetings (Recordings, etc.)-&amp;gt;Cloud Recordings tab).  Note that here you&amp;#039;ll also see chat messages.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Lecture 20&lt;br /&gt;
----------&lt;br /&gt;
&lt;br /&gt;
Lanugage runtimes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Operating System (P)  |   Applications&lt;br /&gt;
--------------------------------------&lt;br /&gt;
Hardware (CPU/RAM/Devices)&lt;br /&gt;
&lt;br /&gt;
P = runs with full privileges&lt;br /&gt;
&lt;br /&gt;
Applications written is languages like C, C++ run directly on&lt;br /&gt;
the hardware&lt;br /&gt;
 - compile to machine code specific to the CPU of the system&lt;br /&gt;
&lt;br /&gt;
So, like the operating system, applications in C and C++ run&lt;br /&gt;
&amp;quot;directly&amp;quot; on the hardware&lt;br /&gt;
  - CPU runs in a special mode that limits access to hardware&lt;br /&gt;
    (user mode)&lt;br /&gt;
  - when running the OS, CPU runs in supervisor mode (full access)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But...most languages we program in today don&amp;#039;t work like this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                    |  bytecode or source code&lt;br /&gt;
OS (P)|  Native App |  Language runtime&lt;br /&gt;
----------------------------------------&lt;br /&gt;
Hardware (CPU/RAM/Devices)&lt;br /&gt;
&lt;br /&gt;
Java: compiled to bytecode, run (JIT compiled &amp;amp; run)&lt;br /&gt;
      in a Java Virtual Machine&lt;br /&gt;
Python: compiled to bytecode or run directly in python VM&lt;br /&gt;
JavaScript: just-in-time compiled to machine code by JavaScript VM&lt;br /&gt;
&lt;br /&gt;
Traditionally, we had either compiled or interpreted languages&lt;br /&gt;
 - compiled ones were converted to machine code once,&lt;br /&gt;
   machine code was then run&lt;br /&gt;
 - interpreted were &amp;quot;interpreted&amp;quot; line by line, running appropriate&lt;br /&gt;
   code as needed&lt;br /&gt;
&lt;br /&gt;
Interpreted is much much slower, but there&amp;#039;s no slow compile step&lt;br /&gt;
  - allows for fast development&lt;br /&gt;
  - also can require modest resources (RAM-wise)&lt;br /&gt;
&lt;br /&gt;
bytecode: compiled from source, but not machine code&lt;br /&gt;
  - easier to process&lt;br /&gt;
  &lt;br /&gt;
code optimization: make code run faster/take up less space&lt;br /&gt;
&lt;br /&gt;
But nowadays, we have just-in-time compiled languages&lt;br /&gt;
 - source or bytecode =&amp;gt; machine code as needed&lt;br /&gt;
&lt;br /&gt;
In fact, code may be compiled multiple times&lt;br /&gt;
 - fast compile to get things running quickly,&lt;br /&gt;
   but code isn&amp;#039;t optimized&lt;br /&gt;
 - slower compile for frequently run code&lt;br /&gt;
   (takes longer to optimize code, but&lt;br /&gt;
    result runs faster)&lt;br /&gt;
&lt;br /&gt;
The simplest translation of source to machine code is mostly looking&lt;br /&gt;
things up in a table&lt;br /&gt;
 - A =&amp;gt; B&lt;br /&gt;
 - but this is far from the most efficient way of doing things&lt;br /&gt;
&lt;br /&gt;
Most sophisticated JIT runtimes are now for JavaScript&lt;br /&gt;
 - borrow heavily from Java runtimes (JVM&amp;#039;s)&lt;br /&gt;
 - which borrowed heavily from LISP runtimes&lt;br /&gt;
&lt;br /&gt;
JavaScript runtimes got so good they ended up on the server&lt;br /&gt;
 - node.js, Deno&lt;br /&gt;
&lt;br /&gt;
Note that PHP &amp;amp; Python also use some amount to just-in-time&lt;br /&gt;
compilation&lt;br /&gt;
 - but in general language runtimes are slower than JavaScript ones&lt;br /&gt;
&lt;br /&gt;
The speed difference is mostly due to effort spent in making a better runtime&lt;br /&gt;
 - JIT runtimes are very complex&lt;br /&gt;
   - and depend heavily on language semantics&lt;br /&gt;
&lt;br /&gt;
Python is notorious for having a slow runtime (CPython)&lt;br /&gt;
 - but there&amp;#039;s alternatives like PyPy (that aren&amp;#039;t completely compatible)&lt;br /&gt;
&lt;br /&gt;
So how can Python be used for machine learning?&lt;br /&gt;
 - they call libraries written in C/C++  (e.g. NumPy)&lt;br /&gt;
   - and they do most of the work&lt;br /&gt;
&lt;br /&gt;
Julia is an alternative to Python with a very fast runtime&lt;br /&gt;
 - but can be slow to start up&lt;br /&gt;
&lt;br /&gt;
For complex apps, dev time in higher level languages is much less,&lt;br /&gt;
and resulting code can be comparably fast, depending on the app&lt;br /&gt;
&lt;br /&gt;
If you look up comparisons of programming languages, you&amp;#039;ll&lt;br /&gt;
see that C and C++ are near the top, but other languages show up&lt;br /&gt;
 - Fortran&lt;br /&gt;
 - Julia&lt;br /&gt;
 - Lua&lt;br /&gt;
&lt;br /&gt;
And other languages can be surprisingly competitive, depending on the runtime&lt;br /&gt;
&lt;br /&gt;
Basically, avoid using C and C++ unless you have to&lt;br /&gt;
 - but choose the right language for the task&lt;br /&gt;
 - consider performance, but in practice other factors are more important generally (security, platform integration, libraries)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Soma</name></author>
	</entry>
</feed>