45 ^ (benchmarkSuiteClass class:self selector: selector ) run |
45 ^ (benchmarkSuiteClass class:self selector: selector ) run |
46 |
46 |
47 " |
47 " |
48 PPCBenchmark run: #benchmarkRBParserC |
48 PPCBenchmark run: #benchmarkRBParserC |
49 " |
49 " |
|
50 ! |
|
51 |
|
52 spy: benchmark |
|
53 | benchmarkInstanceClass | |
|
54 |
|
55 benchmarkInstanceClass := Smalltalk at: #BenchmarkInstance. |
|
56 benchmarkInstanceClass isNil ifTrue:[ |
|
57 self error: 'CalipeL is not loaded.' |
|
58 ]. |
|
59 |
|
60 ^ (benchmarkInstanceClass class:self selector:benchmark) spy |
|
61 |
|
62 "Created: / 11-05-2015 / 16:31:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
63 "Modified: / 16-05-2015 / 19:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
50 ! ! |
64 ! ! |
51 |
65 |
52 !PPCBenchmark methodsFor:'benchmark support'! |
66 !PPCBenchmark methodsFor:'benchmark support'! |
53 |
67 |
54 compile: value |
68 compile: value |
368 |
382 |
369 |
383 |
370 input do: [ :source | parser parse: source withContext: context ] |
384 input do: [ :source | parser parse: source withContext: context ] |
371 ! |
385 ! |
372 |
386 |
|
387 benchmarkSmalltalkNoopParserCompiledC |
|
388 <setup: #setupSmalltalkNoopParserCompiled> |
|
389 <teardown: #teardownSmalltalkNoopParserCompiled> |
|
390 <benchmark: 'Petit Smalltalk Parser (noop)- Compiled'> |
|
391 |
|
392 input do: [ :source | parser parse: source withContext: context ] |
|
393 |
|
394 "Created: / 16-05-2015 / 09:45:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
395 ! |
|
396 |
|
397 benchmarkSmalltalkNoopParserTokenizedC |
|
398 <setup: #setupSmalltalkNoopParserTokenized> |
|
399 <teardown: #teardownSmalltalkNoopParserTokenized> |
|
400 <benchmark: 'Petit Smalltalk Parser (noop) - Tokenized'> |
|
401 |
|
402 input do: [ :source | parser parse: source withContext: context ] |
|
403 |
|
404 "Created: / 16-05-2015 / 09:46:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
405 ! |
|
406 |
373 benchmarkSmalltalkParserC |
407 benchmarkSmalltalkParserC |
374 <setup: #setupSmalltalkParser> |
408 <setup: #setupSmalltalkParser> |
375 <benchmark: 'Petit Smalltalk Parser - Standard'> |
409 <benchmark: 'Petit Smalltalk Parser - Standard'> |
376 |
410 |
377 input do: [ :source | parser parse: source withContext: context ] |
411 input do: [ :source | parser parse: source withContext: context ] |
382 <teardown: #teardownSmalltalkParserCompiled> |
416 <teardown: #teardownSmalltalkParserCompiled> |
383 <benchmark: 'Petit Smalltalk Parser - Compiled'> |
417 <benchmark: 'Petit Smalltalk Parser - Compiled'> |
384 |
418 |
385 input do: [ :source | parser parse: source withContext: context ] |
419 input do: [ :source | parser parse: source withContext: context ] |
386 |
420 |
|
421 ! |
|
422 |
|
423 benchmarkSmalltalkParserTokenizedC |
|
424 <setup: #setupSmalltalkParserTokenized> |
|
425 <teardown: #teardownSmalltalkParserTokenized> |
|
426 <benchmark: 'Petit Smalltalk Parser - Tokenized'> |
|
427 |
|
428 input do: [ :source | parser parse: source withContext: context ] |
|
429 |
|
430 "Created: / 16-05-2015 / 09:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
387 ! ! |
431 ! ! |
388 |
432 |
389 !PPCBenchmark methodsFor:'intitialization'! |
433 !PPCBenchmark methodsFor:'intitialization'! |
390 |
434 |
391 context |
435 context |
563 ] ifFalse: [ |
607 ] ifFalse: [ |
564 input := sources smalltalkSourcesBig. |
608 input := sources smalltalkSourcesBig. |
565 ] |
609 ] |
566 ! |
610 ! |
567 |
611 |
|
612 setupSmalltalkNoopParserCompiled |
|
613 |
|
614 configuration := PPCConfiguration universal. |
|
615 parser := PPCSmalltalkNoopParser new compileWithConfiguration: configuration. |
|
616 context := PPCContext new. |
|
617 context initializeFor: parser. |
|
618 input := sources smalltalkSourcesBig. |
|
619 |
|
620 "Created: / 16-05-2015 / 09:44:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
621 ! |
|
622 |
|
623 setupSmalltalkNoopParserTokenized |
|
624 |
|
625 configuration := PPCConfiguration LL1. |
|
626 parser := PPCSmalltalkNoopParser new compileWithConfiguration: configuration. |
|
627 context := PPCContext new. |
|
628 context initializeFor: parser. |
|
629 input := sources smalltalkSourcesBig. |
|
630 |
|
631 "Created: / 16-05-2015 / 09:44:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
632 ! |
|
633 |
568 setupSmalltalkParser |
634 setupSmalltalkParser |
569 |
635 |
570 parser := PPSmalltalkParser new. |
636 parser := PPSmalltalkParser new. |
571 context := self context. |
637 context := self context. |
572 context initializeFor: parser. |
638 context initializeFor: parser. |
615 |
681 |
616 teardownSmalltalkGrammarTokenized |
682 teardownSmalltalkGrammarTokenized |
617 parser class removeFromSystem. |
683 parser class removeFromSystem. |
618 ! |
684 ! |
619 |
685 |
|
686 teardownSmalltalkNoopParserCompiled |
|
687 parser class removeFromSystem. |
|
688 " |
|
689 size := input inject: 0 into: [:r :e | r + e size ]. |
|
690 Transcript crShow: 'Compiled Grammar time: ', time asString. |
|
691 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
|
692 " |
|
693 |
|
694 "Created: / 16-05-2015 / 09:44:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
695 ! |
|
696 |
|
697 teardownSmalltalkNoopParserTokenized |
|
698 parser class removeFromSystem. |
|
699 " |
|
700 size := input inject: 0 into: [:r :e | r + e size ]. |
|
701 Transcript crShow: 'Compiled Grammar time: ', time asString. |
|
702 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
|
703 " |
|
704 |
|
705 "Created: / 16-05-2015 / 09:44:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
706 ! |
|
707 |
620 teardownSmalltalkParserCompiled |
708 teardownSmalltalkParserCompiled |
621 parser class removeFromSystem. |
709 parser class removeFromSystem. |
622 " |
710 " |
623 size := input inject: 0 into: [:r :e | r + e size ]. |
711 size := input inject: 0 into: [:r :e | r + e size ]. |
624 Transcript crShow: 'Compiled Grammar time: ', time asString. |
712 Transcript crShow: 'Compiled Grammar time: ', time asString. |
625 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
713 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
626 " |
714 " |
|
715 ! |
|
716 |
|
717 teardownSmalltalkParserTokenized |
|
718 parser class removeFromSystem. |
|
719 " |
|
720 size := input inject: 0 into: [:r :e | r + e size ]. |
|
721 Transcript crShow: 'Compiled Grammar time: ', time asString. |
|
722 Transcript crShow: 'Time per character: ', (time / size * 1000.0) asString, ' microseconds'. |
|
723 " |
|
724 |
|
725 "Created: / 16-05-2015 / 09:47:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
627 ! ! |
726 ! ! |
628 |
727 |
629 !PPCBenchmark class methodsFor:'documentation'! |
728 !PPCBenchmark class methodsFor:'documentation'! |
630 |
729 |
631 version_HG |
730 version_HG |