The test is using string literals, which may be optimized in various��ways. Is that representative of your use case?

On Fri, Mar 15, 2024 at 3:12 PM Noury Bouraqadi <bouraqadi@gmail.com> wrote:
I thought streamContents: was faster than using a comma binary message...
I was wrong. Pharo is not Java :-)

Noury

"Run in P11"

a := 'aaaaa'.
b := 'bbbbb'.
c := 'ccccc'.
d := 'ddddd'.
e := 'eeeeee'.
[ a , b , c , d , e ] bench.
"'3958888.090 per second'"
"'3808242.503 per second'"

[
String streamContents: [ :str |
str
<< a;
<< b;
<< c;
<< d;
<< e ] ] bench
"'3083603.838 per second'"
"'2927641.144 per second'" a := 'aaaaa'.
b := 'bbbbb'.
c := 'ccccc'.
d := 'ddddd'.
e := 'eeeeee'.
[ a , b , c , d , e ] bench.
"'3958888.090 per second'"
"'3808242.503 per second'"
[
String streamContents: [ :str |
str
<< a;
<< b;
<< c;
<< d;
<< e ] ] bench
"'3083603.838 per second'"
"'2927641.144 per second'"
a := 'aaaaa'.
b := 'bbbbb'.
c := 'ccccc'.
d := 'ddddd'.
e := 'eeeeee'.
[ a , b , c , d , e ] bench.
"'3958888.090 per second'"
"'3808242.503 per second'"
[
String streamContents: [ :str |
str
<< a;
<< b;
<< c;
<< d;
<< e ] ] bench
"'3083603.838 per second'"
"'2927641.144 per second'"