[fpc-other] Interpreter speed
Bernd Oppolzer
bernd.oppolzer at t-online.de
Sat Apr 29 18:15:09 CEST 2023
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 - fpc-other at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other
More information about the fpc-other
mailing list