Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-other / 2023-04

Interpreter speed

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adriaan van Os

Out of curiosity — has anybody compared the speed of

1. interpreting a parsed syntax tree, versus
2. interpreting byte code, versus
3. interpreting a RISC CPU ?

Regards,

Adriaan van Os

Reply by email

Bernd Oppolzer
to Adriaan van Os

This may be slightly off-topic, but I can tell you some facts about my Stanford Pascal compiler,
which runs

- native on z Mainframe machines (which may count as a RISC machine, given the instruction set used)
- emulated by Hercules, which is a emulator of z Mainframes
- by emulating P-Code, which is a (sort of) byte code for Pascal ... the P-Code (which is pure text, portable)
is translated to a byte code representation before execution; static linking is also done in this stage

The times for compiling the compiler (first pass, 26.000 lines) are as follows:

- native on z machine: 0.1 seconds
- emulating z by Hercules using a very old z operating system: 10 to 12 seconds
- similar (10 to 15 seconds), when running on Windows and emulating the P-Code;
this includes the time to translate the P-Code char representation ... depending on the
power of the used laptop etc., of course.

This makes a factor of 100 for the two emulation strategies, compared to the native execution.

The times are CPU times as reported by the builtin function CLOCK.

Windows example:

c:\work\pascal\work\src>pp pascal1

PCINT (Build 1.0 Jun 15 2022 08:21:21)

   **** STANFORD PASCAL COMPILER, OPPOLZER VERSION OF 2023.03 ****

   **** Compiler Summary ****
   ****      No Errors, no Warnings.
   ****   26058 LINE(S) READ,  243 PROCEDURE(S) COMPILED,    ****   75130 P_INSTRUCTIONS GENERATED,  13.55 SECONDS IN COMPILATION.

*** EXIT Aufruf mit Parameter = 0 ***

HTH, kind regards

Bernd

http://bernd-oppolzer.de/job9.htm

Adriaan van Os wrote 13 lines
Out of curiosity — has anybody compared the speed of 1. interpreting a parsed syntax tree, versus 2. interpreting byte code, versus 3. interpreting a RISC CPU ? Regards, Adriaan van Os _______________________________________________ fpc-other maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other

Reply by email

Bernd Oppolzer
to Bernd Oppolzer

On the same machine:

PASCAL1 compiled with Stanford Pascal, running on the Hercules emulator:

pp pascal1
EXEC PASCAL PASCAL1
STATE PASCAL1 PASCAL A
EXEC PASCOMP PASCAL1
   **** STANFORD PASCAL COMPILER, OPPOLZER VERSION OF 2023.03 ****

   **** Compiler Summary ****
   ****      No Errors, no Warnings.
   ****   26042 LINE(S) READ,  243 PROCEDURE(S) COMPILED,    ****   75126 P_INSTRUCTIONS GENERATED,   9.40 SECONDS IN COMPILATION. EXEC PASC370 PASCAL1
   **** STANFORD PASCAL POST-PROCESSOR, OPPOLZER VERSION OF 2023.03

   ****      NO ASSEMBLY ERROR(S) DETECTED.    ****  265999 BYTES OF CODE GENERATED,   8.24 SECONDS IN POST_PROCESSING. EXEC PASLINK PASCAL1
Ready; T=17.71/27.02 18:17:06

Kind regards

Bernd

Bernd Oppolzer wrote 65 lines
This may be slightly off-topic, but I can tell you some facts about my Stanford Pascal compiler, which runs - native on z Mainframe machines (which may count as a RISC machine, given the instruction set used) - emulated by Hercules, which is a emulator of z Mainframes - by emulating P-Code, which is a (sort of) byte code for Pascal ... the P-Code (which is pure text, portable) is translated to a byte code representation before execution; static linking is also done in this stage The times for compiling the compiler (first pass, 26.000 lines) are as follows: - native on z machine: 0.1 seconds - emulating z by Hercules using a very old z operating system: 10 to 12 seconds - similar (10 to 15 seconds), when running on Windows and emulating the P-Code; this includes the time to translate the P-Code char representation ... depending on the power of the used laptop etc., of course. This makes a factor of 100 for the two emulation strategies, compared to the native execution. The times are CPU times as reported by the builtin function CLOCK. Windows example: c:\work\pascal\work\src>pp pascal1 PCINT (Build 1.0 Jun 15 2022 08:21:21)    **** STANFORD PASCAL COMPILER, OPPOLZER VERSION OF 2023.03 ****    **** Compiler Summary ****    ****      No Errors, no Warnings.    ****   26058 LINE(S) READ,  243 PROCEDURE(S) COMPILED,    ****   75130 P_INSTRUCTIONS GENERATED,  13.55 SECONDS IN COMPILATION. *** EXIT Aufruf mit Parameter = 0 *** HTH, kind regards Bernd http://bernd-oppolzer.de/job9.htm Am 28.04.2023 um 09:20 schrieb Adriaan van Os via fpc-other: > Out of curiosity — has anybody compared the speed of > > 1. interpreting a parsed syntax tree, versus > 2. interpreting byte code, versus > 3. interpreting a RISC CPU ? > > Regards, > > Adriaan van Os > > _______________________________________________ > fpc-other maillist  -  > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other

Reply by email

geneb
to Bernd Oppolzer: This may be slightly off-topic, but I can tell you some facts about my which runs -…
Bernd Oppolzer wrote 12 lines
This may be slightly off-topic, but I can tell you some facts about my Stanford Pascal compiler, which runs - native on z Mainframe machines (which may count as a RISC machine, given the instruction set used) - emulated by Hercules, which is a emulator of z Mainframes - by emulating P-Code, which is a (sort of) byte code for Pascal ... the P-Code (which is pure text, portable) is translated to a byte code representation before execution; static linking is also done in this stage

Bernd, is the dialect used by that compiler "standard" Pascal, UCSD Pascal, Turbo-compatible, or?

tnx.

g.

Proud owner of F-15C 80-0007 http://www.f15sim.com - The only one of its kind. http://www.diy-cockpits.org/coll - Go Collimated or Go Home. Some people collect things for a hobby. Geeks collect hobbies. ScarletDME - The red hot Data Management Environment A Multi-Value database for the masses, not the classes. http://scarlet.deltasoft.com - Get it _today_!

Reply by email

Bernd Oppolzer
to geneb
geneb wrote 22 lines
On Sat, 29 Apr 2023, Bernd Oppolzer via fpc-other wrote: > This may be slightly off-topic, but I can tell you some facts about > my Stanford Pascal compiler, > which runs > > - native on z Mainframe machines (which may count as a RISC machine, > given the instruction set used) > - emulated by Hercules, which is a emulator of z Mainframes > - by emulating P-Code, which is a (sort of) byte code for Pascal ... > the P-Code (which is pure text, portable) > is translated to a byte code representation before execution; static > linking is also done in this stage > Bernd, is the dialect used by that compiler "standard" Pascal, UCSD Pascal, Turbo-compatible, or? tnx. g.

The dialect implemented by the New Stanford Pascal compiler is "standard" Pascal with some extensions,
for example

- extended const syntax (for structures and arrays etc.)
- support for external procedures (contained in "modules")
- CHAR(n) data type
- string data type
- static definitions
- initializations of variables and statics
- OTHERWISE on CASE
- BREAK, CONTINUE, RETURN
- direct read and write of scalar types (enums)
- with clause on record types
- pointers on variables which are not on the heap
- pointer arithmetic
- many new builtin procedures and functions

A short "language reference" (23 pages), which covers the differences to "standard" Pascal,
is available from this website: http://bernd-oppolzer.de/job9.htm see the link on top of the page, just below the picture.

Kind regards

Bernd

Reply by email

Adriaan van Os
to Bernd Oppolzer: This may be slightly off-topic, but I can tell you some facts about my which runs -…
Bernd Oppolzer wrote 11 lines
This may be slightly off-topic, but I can tell you some facts about my Stanford Pascal compiler, which runs - native on z Mainframe machines (which may count as a RISC machine, given the instruction set used) - emulated by Hercules, which is a emulator of z Mainframes - by emulating P-Code, which is a (sort of) byte code for Pascal ... the P-Code (which is pure text, portable) is translated to a byte code representation before execution; static linking is also done in this stage

Interesting, thanks.

Adriaan van Os

Reply by email

geneb
to Bernd Oppolzer: The dialect implemented by the New Stanford Pascal compiler is "standard" Pascal with…
Bernd Oppolzer wrote 30 lines
Am 29.04.2023 um 19:48 schrieb geneb via fpc-other: > On Sat, 29 Apr 2023, Bernd Oppolzer via fpc-other wrote: > >> This may be slightly off-topic, but I can tell you some facts about my >> Stanford Pascal compiler, >> which runs >> >> - native on z Mainframe machines (which may count as a RISC machine, given >> the instruction set used) >> - emulated by Hercules, which is a emulator of z Mainframes >> - by emulating P-Code, which is a (sort of) byte code for Pascal ... the >> P-Code (which is pure text, portable) >> is translated to a byte code representation before execution; static >> linking is also done in this stage >> > > Bernd, is the dialect used by that compiler "standard" Pascal, UCSD Pascal, > Turbo-compatible, or? > > tnx. > > g. > A short "language reference" (23 pages), which covers the differences to "standard" Pascal, is available from this website: http://bernd-oppolzer.de/job9.htm see the link on top of the page, just below the picture.

Thanks! I'll take a
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home. Some people collect things for a hobby. Geeks collect hobbies.

ScarletDME - The red hot Data Management Environment A Multi-Value database for the masses, not the classes. http://scarlet.deltasoft.com - Get it _today_!

Reply by email