equal
deleted
inserted
replaced
33 " |
33 " |
34 PPCBenchmark run. |
34 PPCBenchmark run. |
35 " |
35 " |
36 ! |
36 ! |
37 |
37 |
38 run: selector |
38 run: selectorOrSelectors |
39 | benchmarkSuiteClass | |
39 | benchmarkSuiteClass benchmarkSuite | |
40 |
40 |
41 benchmarkSuiteClass := Smalltalk at: #BenchmarkSuite. |
41 benchmarkSuiteClass := Smalltalk at: #BenchmarkSuite. |
42 benchmarkSuiteClass isNil ifTrue:[ |
42 benchmarkSuiteClass isNil ifTrue:[ |
43 self error: 'CalipeL is not loaded.' |
43 self error: 'CalipeL is not loaded.' |
44 ]. |
44 ]. |
45 ^ (benchmarkSuiteClass class:self selector: selector ) run |
45 selectorOrSelectors isSymbol ifTrue:[ |
46 |
46 benchmarkSuite := (benchmarkSuiteClass class:self selector: selectorOrSelectors ) run |
|
47 ] ifFalse:[ |
|
48 benchmarkSuite := benchmarkSuiteClass new. |
|
49 selectorOrSelectors do:[:each | |
|
50 benchmarkSuite addBenchmark: (BenchmarkInstance class: self selector: each) |
|
51 ]. |
|
52 ]. |
|
53 ^ benchmarkSuite run |
47 " |
54 " |
48 PPCBenchmark run: #benchmarkRBParserC |
55 PPCBenchmark run: #benchmarkRBParserC |
49 " |
56 " |
|
57 |
|
58 "Modified: / 18-08-2015 / 16:34:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
50 ! |
59 ! |
51 |
60 |
52 spy: benchmark |
61 spy: benchmark |
53 | benchmarkInstanceClass | |
62 | benchmarkInstanceClass | |
54 |
63 |
357 |
366 |
358 input do: [ :source | parser parse: source withContext: context ] |
367 input do: [ :source | parser parse: source withContext: context ] |
359 |
368 |
360 ! |
369 ! |
361 |
370 |
|
371 benchmarkLRPParserC |
|
372 <setup: #setupLRPParser> |
|
373 <benchmark: 'LRP Parser - Standard'> |
|
374 |
|
375 1000 timesRepeat:[ |
|
376 input do: [ :source | parser parse: source withContext: context ] |
|
377 ] |
|
378 |
|
379 "Created: / 18-08-2015 / 16:27:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
380 ! |
|
381 |
|
382 benchmarkLRPParserCompiledC |
|
383 <setup: #setupLRPParserCompiled> |
|
384 <teardown: #teardownLRPParserCompiled> |
|
385 <benchmark: 'LRP Parser - Compiled'> |
|
386 |
|
387 1000 timesRepeat:[ |
|
388 input do: [ :source | parser parse: source withContext: context ] |
|
389 ] |
|
390 |
|
391 "Created: / 18-08-2015 / 16:26:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
392 ! |
|
393 |
|
394 benchmarkLRPParser_johanfabry_39C |
|
395 <setup: #setupLRPParser> |
|
396 <benchmark: 'LRP Parser - Standard johanfabry.39'> |
|
397 |
|
398 1000 timesRepeat:[ |
|
399 input do: [ :source | parser parse: source withContext: context ] |
|
400 ] |
|
401 |
|
402 "Created: / 18-08-2015 / 16:49:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
403 ! |
|
404 |
362 benchmarkRBParserC |
405 benchmarkRBParserC |
363 <setup: #setupRBParser> |
406 <setup: #setupRBParser> |
364 <benchmark: 'RB Smalltalk Parser'> |
407 <benchmark: 'RB Smalltalk Parser'> |
365 |
408 |
366 input do: [ :source | RBParser parseMethod: source ] |
409 input do: [ :source | RBParser parseMethod: source ] |
574 context := self context. |
617 context := self context. |
575 context initializeFor: parser. |
618 context initializeFor: parser. |
576 input := sources expressionSourcesBig. |
619 input := sources expressionSourcesBig. |
577 ! |
620 ! |
578 |
621 |
|
622 setupLRPParser |
|
623 |
|
624 parser := PPCLRPParser new. |
|
625 context := self context. |
|
626 context initializeFor: parser. |
|
627 input := PPCLRPSourcesResource current sources |
|
628 |
|
629 "Created: / 18-08-2015 / 16:34:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
630 ! |
|
631 |
|
632 setupLRPParserCompiled |
|
633 |
|
634 configuration := PPCConfiguration universal. |
|
635 parser := PPCLRPParser new compileWithConfiguration: configuration. |
|
636 context := self context. |
|
637 context initializeFor: parser. |
|
638 input := PPCLRPSourcesResource current sources |
|
639 |
|
640 "Created: / 18-08-2015 / 16:35:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
641 ! |
|
642 |
|
643 setupLRPParser_johanfabry_39 |
|
644 |
|
645 parser := PPCLRPParser_johanfabry_39 new. |
|
646 context := self context. |
|
647 context initializeFor: parser. |
|
648 input := PPCLRPSourcesResource current sources |
|
649 |
|
650 "Created: / 18-08-2015 / 16:48:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
651 ! |
|
652 |
579 setupRBParser |
653 setupRBParser |
580 |
654 |
581 input := sources smalltalkSourcesBig. |
655 input := sources smalltalkSourcesBig. |
582 ! |
656 ! |
583 |
657 |
683 Transcript crShow: 'Compiled Grammar time: ', time asString. |
757 Transcript crShow: 'Compiled Grammar time: ', time asString. |
684 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
758 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
685 " |
759 " |
686 ! |
760 ! |
687 |
761 |
|
762 teardownLRPParserCompiled |
|
763 parser class removeFromSystem. |
|
764 " |
|
765 size := input inject: 0 into: [:r :e | r + e size ]. |
|
766 Transcript crShow: 'Compiled Grammar time: ', time asString. |
|
767 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
|
768 " |
|
769 |
|
770 "Created: / 18-08-2015 / 16:36:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
771 ! |
|
772 |
688 teardownSmalltalkGrammarCompiled |
773 teardownSmalltalkGrammarCompiled |
689 parser class removeFromSystem. |
774 parser class removeFromSystem. |
690 " |
775 " |
691 size := input inject: 0 into: [:r :e | r + e size ]. |
776 size := input inject: 0 into: [:r :e | r + e size ]. |
692 Transcript crShow: 'Compiled Grammar time: ', time asString. |
777 Transcript crShow: 'Compiled Grammar time: ', time asString. |