[squeak-dev] The Inbox: Compiler-mt.437.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Sat Jun 13 10:45:29 UTC 2020


Hi Fabio,

> ... so I was looking for a speedup.

Here is the speed up for the same idea (and improvement of that idea) for the Shout Parser:

http://forum.world.st/The-Inbox-ShoutCore-mt-78-mcz-tp5118289p5118350.html [http://forum.world.st/The-Inbox-ShoutCore-mt-78-mcz-tp5118289p5118350.html]

vs.
http://forum.world.st/The-Inbox-ShoutCore-mt-78-mcz-tp5118289p5118351.html [http://forum.world.st/The-Inbox-ShoutCore-mt-78-mcz-tp5118289p5118351.html]


Sorry for the confusion.

Best,
Marcel
Am 13.06.2020 12:43:19 schrieb Fabio Niephaus <lists at fniephaus.com>:


On Sat, 13 Jun 2020 at 12:41 pm, Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]> wrote:

Hi Fabio!

> Am I reading this wrong, or is after worse than before?

Huh? Of course it is a little bit worse. I am proposing an extension hook for pragma parsing here. :-) The goal is to make the overhead as thin as possible.

I was confused because the commit message says "Speed-up method-based hook...", so I was looking for a speedup.

Fabio


"=== BEFORE ===" means Compiler-mt.435 in Trunk.
"=== AFTER ===" means Compiler-mt.437 in Inbox but with the Hook enabled, which would allow me to extract FFI-specific parsing code to the FFI-Kernel package.

That's why my examples parse only some methods that have pragmas in them. There is no impact on parsing methods that do not have any pragmas.

Best,
Marcel
Am 13.06.2020 12:36:26 schrieb Fabio Niephaus <lists at fniephaus.com [mailto:lists at fniephaus.com]>:


On Sat, 13 Jun 2020 at 11:17 am, Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]> wrote:

Hi all!

Here are some benchmarks. Same context as here:
http://forum.world.st/The-Inbox-ShoutCore-mt-78-mcz-tp5118289p5118351.html [http://forum.world.st/The-Inbox-ShoutCore-mt-78-mcz-tp5118289p5118351.html]


=== BEFORE ===

{
   "FFITestLibrary>>ffiPrintString:":[
      "39,800 per second. 25.1 microseconds per run. 7.5 % GC time.",
      "41,600 per second. 24 microseconds per run. 3.72 % GC time.",
      "40,800 per second. 24.5 microseconds per run. 3.92 % GC time."
   ],
   "BitBlt>>copyBits":[
      "5,610 per second. 178 microseconds per run. 2.26 % GC time.",
      "5,590 per second. 179 microseconds per run. 2.65947 % GC time.",
      "5,550 per second. 180 microseconds per run. 2.95941 % GC time."
   ],
   "ExternalPoolReadWriter>>fetchFromFile":[
      "25,800 per second. 38.7 microseconds per run. 2.9794 % GC time.",
      "25,800 per second. 38.8 microseconds per run. 3.19936 % GC time.",
      "26,000 per second. 38.5 microseconds per run. 3.14 % GC time."
   ],
   "Win32Pool class>>winver":[
      "16,100 per second. 62 microseconds per run. 3.65927 % GC time.",
      "16,200 per second. 61.7 microseconds per run. 3.66 % GC time.",
      "16,100 per second. 62 microseconds per run. 3.52 % GC time."
   ]
}

=== AFTER ===

{
   "FFITestLibrary>>ffiPrintString:":[
      "37,200 per second. 26.8 microseconds per run. 7.4785 % GC time.",
      "37,800 per second. 26.4 microseconds per run. 6.77864 % GC time.",
      "37,400 per second. 26.7 microseconds per run. 7.16 % GC time."
   ],
   "BitBlt>>copyBits":[
      "5,140 per second. 195 microseconds per run. 8.04 % GC time.",
      "5,220 per second. 192 microseconds per run. 8.22 % GC time.",
      "5,270 per second. 190 microseconds per run. 8.22 % GC time."
   ],
   "ExternalPoolReadWriter>>fetchFromFile":[
      "24,000 per second. 41.7 microseconds per run. 9.43811 % GC time.",
      "23,900 per second. 41.9 microseconds per run. 9.25815 % GC time.",
      "23,500 per second. 42.6 microseconds per run. 9.3 % GC time."
   ],
   "Win32Pool class>>winver":[
      "13,900 per second. 72.1 microseconds per run. 8.88 % GC time.",
      "13,700 per second. 73 microseconds per run. 8.58 % GC time.",
      "13,800 per second. 72.6 microseconds per run. 8.7 % GC time."
   ]
}

Am I reading this wrong, or is after worse than before?

Fabio


Best,
Marcel
Am 13.06.2020 11:01:53 schrieb commits at source.squeak.org [mailto:commits at source.squeak.org] <commits at source.squeak.org [mailto:commits at source.squeak.org]>:
A new version of Compiler was added to project The Inbox:
http://source.squeak.org/inbox/Compiler-mt.437.mcz [http://source.squeak.org/inbox/Compiler-mt.437.mcz]

==================== Summary ====================

Name: Compiler-mt.437
Author: mt
Time: 13 June 2020, 11:01:44.448351 am
UUID: ca2e1da8-da26-a840-ae3e-1822ce8ba67d
Ancestors: Compiler-mt.436

Speed-up method-based hook for custom pragma-parsing methods. Like in ShoutCore-mt.79

=============== Diff against Compiler-mt.436 ===============

Item was changed:
----- Method: Parser>>pragmaStatement (in category 'pragmas') -----
pragmaStatement
"Read a single pragma statement. Dispatch to the first available pragma parser using the current token as a simple getter to be called on self. If no pragma parser can be found, parse it as usual in the keywords form.

Note that custom pragma parsers need to fulfill two requirements:
(1) method selector must match the current token as simple getter,
e.g., matches #apicall or matches #primitive
(2) method must declare to be called.
This is for the protection of the parser's (message) namespace."

+ | parserSelector |
- | parserSelector parserMethod |
(hereType = #keyword or: [ hereType = #word or: [ hereType = #binary ] ])
ifFalse: [ ^ self expected: 'pragma declaration' ].

+ (here last == $:
+ and: [(parserSelector := Symbol lookup: here allButLast) notNil])
+ ifFalse: ["Quick exit to not break one-word pragmas such as and ; also avoid interning new symbols for made-up pragmas such as for not interning #my."

+ ^ self pragmaStatementKeywords].
- (self class includesSelector: (parserSelector := here asSimpleGetter)) ifTrue: [
- ((parserMethod := self class compiledMethodAt: parserSelector) pragmas
- anySatisfy: [:pragma | pragma keyword == #pragmaParser])
- ifTrue: [^ self executeMethod: parserMethod]].

+ self class methodDict
+ at: parserSelector
+ ifPresent: [:parserMethod |
+ (parserMethod pragmas
+ anySatisfy: [:pragma | pragma keyword == #pragmaParser])
+ ifTrue: [^ self executeMethod: parserMethod]].
+
^ self pragmaStatementKeywords!




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200613/fb6d74d1/attachment.html>


More information about the Squeak-dev mailing list