Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.os.development > #9128
| From | Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> |
|---|---|
| Newsgroups | alt.os.development |
| Subject | Re: Smaller C |
| Date | 2016-01-23 13:19 -0500 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <20160123131905.5782c340@_> (permalink) |
| References | (4 earlier) <0e0bffb0-2082-4832-9bb0-8e66b64bc0b3@googlegroups.com> <op.x57purfuyfako5@localhost> <b3c0f7f5-bc42-497c-8aa8-657dc37e5a0a@googlegroups.com> <op.x59p1konyfako5@localhost> <n7ds7a$nld$1@dont-email.me> |
On Sat, 16 Jan 2016 16:50:12 +0000
James Harris <james.harris.1@gmail.com> wrote:
> On 10/10/2015 03:18, Rod Pemberton wrote:
> > On Fri, 09 Oct 2015 05:50:47 -0400, Alexei A. Frounze
> > <alexfrunews@gmail.com> wrote:
...
> >> Even if you think that something like Python isn't a
> >> serious language (it has plenty of shortcomings) or isn't
> >> going to stay, useful things get done in it and it's
> >> much easier to write in it than in C because the language
> >> is richer and there's quite a bit of stuff in its library,
> >> which has no match in the standard C library. Of course,
> >> not all richness is necessary or very useful, but some
> >> is.
> >
> > I've not used Python, AFAIR. IIRC, it's converted to C.
>
> Python is normally converted to bytecode. You can compile text to
> bytecode and disassemble that bytecode to see what it does. For
> example, the following python code compiles a simple assignment and
> disassembles the resulting bytecode.
>
> import dis
> x = compile('a = 1', '', 'single')
> dis.dis(x)
>
> The result is this disassembly:
>
> 0 LOAD_CONST 0 (1)
> 3 STORE_NAME 0 (a)
> 6 LOAD_CONST 1 (None)
> 9 RETURN_VALUE
>
> > For anything which is converted to C, one must ask why
> > not just use C in the first place? That includes just
> > about every language in existence, since they've all
> > emitted C code or were written in it at some point. If
> > someone doesn't have a good justification as to why to
> > not use C, which they usually don't when asked that,
> > then I see no point in them using another language.
>
> Python does make some things very easy to write (as above) but it is
> not suitable for everything. As you can see from the bytecode it
> would be much slower than C, for example.
That depends. If the bytecode is interpreted, then, yes, it'll
be slow.
If it's compiled at some point, then it can be fast. I.e.,
I have programs to convert indirect-threaded code (ITC) Forth
and TLTJHTNO(*) to C, some slightly optimized, which compiles
fine and executes quickly, but perhaps not as quickly as if
written natively in C. ITC and DTC are similar to bytecode
(a.k.a. TTC or token-threaded code) in the sense that they
group the language into a bunch of procedures or routines.
(*)The Language That James Hates the Name Of
Close your eyes James, the rest is for Alexei, if he ever
responds ...
[TLTJHTNO is BrainFuck.]
Rod Pemberton
Back to alt.os.development | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Smaller C Peter Cheung <mcheung63@gmail.com> - 2015-10-07 00:10 -0700
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-07 00:52 -0700
Re: Smaller C Peter Cheung <mcheung63@gmail.com> - 2015-10-07 02:51 -0700
Re: Smaller C "wolfgang kern" <nowhere@never.at> - 2015-10-07 21:01 +0200
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-08 00:25 -0700
Re: Smaller C "wolfgang kern" <nowhere@never.at> - 2015-10-08 10:50 +0200
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-08 02:06 -0700
Re: Smaller C "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-08 19:39 -0400
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-09 01:00 -0700
Re: Smaller C "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-09 20:28 -0400
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-08 00:22 -0700
Re: Smaller C "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-08 20:19 -0400
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-09 02:50 -0700
Re: Smaller C "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-09 22:18 -0400
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-10 01:48 -0700
Re: Smaller C "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-12 01:52 -0400
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2015-10-11 23:49 -0700
Re: Smaller C "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-12 20:33 -0400
Re: Smaller C James Harris <james.harris.1@gmail.com> - 2016-01-16 16:50 +0000
Re: Smaller C Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-01-23 13:19 -0500
Re: Smaller C "Alexei A. Frounze" <alexfrunews@gmail.com> - 2016-01-23 13:54 -0800
csiph-web