Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen


> On 2/11/19 3:27 AM, Timo Paulssen wrote:
> > WHICH doesn't give you a numerical value. just print it as it is.
>
>
> $ p6 'sub a (Buf $b) { say $b.WHICH }; my $c = Buf.new(1,2,3); say
> $c.WHICH; a($c);'
> Buf|71848984
> Buf|71848984
>
> If "moarvm has a moving garbage collector" moves my 100 MB+ buffer
> around, "I am in a heap of trouble".
The buffer lives one indirection (aka pointer) away from the part that
is garbage-collector managed, so moving the object doesn't make a
difference here, luckily.


Re: subs and variables speed question

2019-02-11 Thread ToddAndMargo via perl6-users

On 11/02/2019 07:12, ToddAndMargo via perl6-users wrote:

WHERE is pretty sweet command!


$ p6 'sub a (Buf $b) { say $b.WHERE.base(0x10) }; my $c =
Buf.new(1,2,3); say $c.WHERE.base(0x10); a($c);'

7F385D41334C
7F385D41334C




On 11/02/2019 12:16, ToddAndMargo via perl6-users wrote:

On 2/11/19 2:52 AM, Timo Paulssen wrote:

Please be aware that WHERE will give you the actual memory address of an
object, but moarvm has a moving garbage collector, which means that
objects can change their memory location. at the moment it will only
happen up to two times, i believe.

you'll probably have a better result with .WHICH for what you want to
achieve.


>>
>> $ p6 'sub a (Buf $b) { say $b.WHICH.base(0x10) }; my $c =
>> Buf.new(1,2,3); say $c.WHICH.base(0x10); a($c);'
>> No such method 'base' for invocant of type 'ObjAt'. Did you mean any
>> of these?
>>  Hash
>>  hash
>>  take
>>
>>in block  at -e line 1
>>
>>

On 2/11/19 3:27 AM, Timo Paulssen wrote:
> WHICH doesn't give you a numerical value. just print it as it is.


$ p6 'sub a (Buf $b) { say $b.WHICH }; my $c = Buf.new(1,2,3); say 
$c.WHICH; a($c);'

Buf|71848984
Buf|71848984

If "moarvm has a moving garbage collector" moves my 100 MB+ buffer 
around, "I am in a heap of trouble".


Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen
WHICH doesn't give you a numerical value. just print it as it is.

On 11/02/2019 12:16, ToddAndMargo via perl6-users wrote:
> On 2/11/19 2:52 AM, Timo Paulssen wrote:
>> Please be aware that WHERE will give you the actual memory address of an
>> object, but moarvm has a moving garbage collector, which means that
>> objects can change their memory location. at the moment it will only
>> happen up to two times, i believe.
>>
>> you'll probably have a better result with .WHICH for what you want to
>> achieve.
>>
>> On 11/02/2019 07:12, ToddAndMargo via perl6-users wrote:
>>> WHERE is pretty sweet command!
>>>
>>>
>>> $ p6 'sub a (Buf $b) { say $b.WHERE.base(0x10) }; my $c =
>>> Buf.new(1,2,3); say $c.WHERE.base(0x10); a($c);'
>>>
>>> 7F385D41334C
>>> 7F385D41334C
>
> $ p6 'sub a (Buf $b) { say $b.WHICH.base(0x10) }; my $c =
> Buf.new(1,2,3); say $c.WHICH.base(0x10); a($c);'
> No such method 'base' for invocant of type 'ObjAt'. Did you mean any
> of these?
>     Hash
>     hash
>     take
>
>   in block  at -e line 1
>
>
>


Re: subs and variables speed question

2019-02-11 Thread ToddAndMargo via perl6-users

On 2/11/19 2:52 AM, Timo Paulssen wrote:

Please be aware that WHERE will give you the actual memory address of an
object, but moarvm has a moving garbage collector, which means that
objects can change their memory location. at the moment it will only
happen up to two times, i believe.

you'll probably have a better result with .WHICH for what you want to
achieve.

On 11/02/2019 07:12, ToddAndMargo via perl6-users wrote:

WHERE is pretty sweet command!


$ p6 'sub a (Buf $b) { say $b.WHERE.base(0x10) }; my $c =
Buf.new(1,2,3); say $c.WHERE.base(0x10); a($c);'

7F385D41334C
7F385D41334C


$ p6 'sub a (Buf $b) { say $b.WHICH.base(0x10) }; my $c = 
Buf.new(1,2,3); say $c.WHICH.base(0x10); a($c);'
No such method 'base' for invocant of type 'ObjAt'. Did you mean any of 
these?

Hash
hash
take

  in block  at -e line 1



--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: subs and variables speed question

2019-02-11 Thread Timo Paulssen
Please be aware that WHERE will give you the actual memory address of an
object, but moarvm has a moving garbage collector, which means that
objects can change their memory location. at the moment it will only
happen up to two times, i believe.

you'll probably have a better result with .WHICH for what you want to
achieve.

On 11/02/2019 07:12, ToddAndMargo via perl6-users wrote:
> WHERE is pretty sweet command!
>
>
> $ p6 'sub a (Buf $b) { say $b.WHERE.base(0x10) }; my $c =
> Buf.new(1,2,3); say $c.WHERE.base(0x10); a($c);'
>
> 7F385D41334C
> 7F385D41334C


Re: subs and variables speed question

2019-02-10 Thread ToddAndMargo via perl6-users

On 2/9/19 2:28 PM, ToddAndMargo via perl6-users wrote:

On 2/9/19 1:56 PM, ToddAndMargo via perl6-users wrote:

Hi All,

sub xxx( Buf $YugeBuf is ro ) {some midricle}

Is $YugeBuf (up to 100 MB) a copy of just the structure?
I don't want the time time of a copy.


Many thanks,
-T


Without all the typos:

Hi All,

sub xxx( Buf $YugeBuf is ro ) {some miricle}

Is $YugeBuf (up to 100 MB) a copy of the entire variable
or just the structure?  I don't want the time hit of a copy.

Many thanks,
-T



It is not a duplicate:

[20:30]  A question for the developers.  sub xxx( Buf 
$YugeBuf is ro ) {some miricle} Is $YugeBuf (up to 100 MB) a copy of 
the entire variable or just the structure?  I don't want the time hit of 
a copy
[20:32] == Cabanossi 
[~cabano...@ppp-88-217-73-102.dynamic.mnet-online.de] has joined #perl6
[20:36] == kurahaupo_ 
[~kuraha...@pa49-195-197-60.pa.nsw.optusnet.com.au] has joined #perl6
[20:36] == kurahaupo [~kurahaupo@125.254.10.75] has quit [Read error: 
Connection reset by peer]

[20:36]  ToddAndMargo: it seems to be
[20:37] == kurahaupo_ 
[~kuraha...@pa49-195-197-60.pa.nsw.optusnet.com.au] has quit [Read 
error: Connection reset by peer]
[20:38]  p6: sub a (Buf $b) { say $b.WHERE }; my $c = 
Buf.new(1,2,3); say $c.WHERE; a($c)
[20:38] <+camelia> rakudo-moar d904b7048: OUTPUT: 
«139828431461220␤139828431461220␤»

[20:39] == kurahaupo [~kurahaupo@125.254.10.75] has joined #perl6
[20:45] == kurahaupo [~kurahaupo@125.254.10.75] has quit [Read error: 
Connection reset by peer]
[20:45]  Err, I meant that to be "Buf $b is readonly" but result 
is the same.

[20:46] == kurahaupo [~kurahaupo@125.254.10.75] has joined #perl6
[20:48] == aindilis 
[~aindi...@172-12-3-117.lightspeed.sgnwmi.sbcglobal.net] has quit [Ping 
timeout: 240 seconds]
[20:49]  Even when you use "is copy", the copy doesn't get made 
until after the value has been modified.  Seems Rakudo is smart in that 
regards:
[20:49]  p6: sub a ($a is copy) { say $a.WHERE; $a++; say 
$a.WHERE}; my $b = 1; say $b.WHERE; a($b)
[20:49] <+camelia> rakudo-moar d904b7048: OUTPUT: 
«140226293132168␤140226293132168␤140226293132208␤»
[20:49] == aindilis 
[~aindi...@172-12-3-117.lightspeed.sgnwmi.sbcglobal.net] has joined #perl6
[20:53]  Just be aware that readonly doesn't necessarily mean 
what you might think it does:
[20:53]  p6: sub a (Buf $b is readonly) { $b[0] = 0}; my $c = 
Buf.new(1,2,3); a($c); say $c

[20:53] <+camelia> rakudo-moar d904b7048: OUTPUT: «Buf:0x<00 02 03>␤»


Re: subs and variables speed question

2019-02-10 Thread ToddAndMargo via perl6-users

On 2/9/19 2:28 PM, ToddAndMargo via perl6-users wrote:

On 2/9/19 1:56 PM, ToddAndMargo via perl6-users wrote:

Hi All,

sub xxx( Buf $YugeBuf is ro ) {some midricle}

Is $YugeBuf (up to 100 MB) a copy of just the structure?
I don't want the time time of a copy.


Many thanks,
-T


Without all the typos:

Hi All,

sub xxx( Buf $YugeBuf is ro ) {some miricle}

Is $YugeBuf (up to 100 MB) a copy of the entire variable
or just the structure?  I don't want the time hit of a copy.

Many thanks,
-T



It is not a duplicate:

[20:30]  A question for the developers.  sub xxx( Buf 
$YugeBuf is ro ) {some miricle} Is $YugeBuf (up to 100 MB) a copy of 
the entire variable or just the structure?  I don't want the time hit of 
a copy
[20:32] == Cabanossi 
[~cabano...@ppp-88-217-73-102.dynamic.mnet-online.de] has joined #perl6
[20:36] == kurahaupo_ 
[~kuraha...@pa49-195-197-60.pa.nsw.optusnet.com.au] has joined #perl6
[20:36] == kurahaupo [~kurahaupo@125.254.10.75] has quit [Read error: 
Connection reset by peer]

[20:36]  ToddAndMargo: it seems to be
[20:37] == kurahaupo_ 
[~kuraha...@pa49-195-197-60.pa.nsw.optusnet.com.au] has quit [Read 
error: Connection reset by peer]
[20:38]  p6: sub a (Buf $b) { say $b.WHERE }; my $c = 
Buf.new(1,2,3); say $c.WHERE; a($c)
[20:38] <+camelia> rakudo-moar d904b7048: OUTPUT: 
«139828431461220␤139828431461220␤»

[20:39] == kurahaupo [~kurahaupo@125.254.10.75] has joined #perl6
[20:45] == kurahaupo [~kurahaupo@125.254.10.75] has quit [Read error: 
Connection reset by peer]
[20:45]  Err, I meant that to be "Buf $b is readonly" but result 
is the same.

[20:46] == kurahaupo [~kurahaupo@125.254.10.75] has joined #perl6
[20:48] == aindilis 
[~aindi...@172-12-3-117.lightspeed.sgnwmi.sbcglobal.net] has quit [Ping 
timeout: 240 seconds]
[20:49]  Even when you use "is copy", the copy doesn't get made 
until after the value has been modified.  Seems Rakudo is smart in that 
regards:
[20:49]  p6: sub a ($a is copy) { say $a.WHERE; $a++; say 
$a.WHERE}; my $b = 1; say $b.WHERE; a($b)
[20:49] <+camelia> rakudo-moar d904b7048: OUTPUT: 
«140226293132168␤140226293132168␤140226293132208␤»
[20:49] == aindilis 
[~aindi...@172-12-3-117.lightspeed.sgnwmi.sbcglobal.net] has joined #perl6
[20:53]  Just be aware that readonly doesn't necessarily mean 
what you might think it does:
[20:53]  p6: sub a (Buf $b is readonly) { $b[0] = 0}; my $c = 
Buf.new(1,2,3); a($c); say $c

[20:53] <+camelia> rakudo-moar d904b7048: OUTPUT: «Buf:0x<00 02 03>␤»


Re: subs and variables speed question

2019-02-10 Thread ToddAndMargo via perl6-users

WHERE is pretty sweet command!


$ p6 'sub a (Buf $b) { say $b.WHERE.base(0x10) }; my $c = 
Buf.new(1,2,3); say $c.WHERE.base(0x10); a($c);'


7F385D41334C
7F385D41334C


Re: subs and variables speed question

2019-02-09 Thread ToddAndMargo via perl6-users

On 2/9/19 1:56 PM, ToddAndMargo via perl6-users wrote:

Hi All,

sub xxx( Buf $YugeBuf is ro ) {some midricle}

Is $YugeBuf (up to 100 MB) a copy of just the structure?
I don't want the time time of a copy.


Many thanks,
-T


Without all the typos:

Hi All,

sub xxx( Buf $YugeBuf is ro ) {some miricle}

Is $YugeBuf (up to 100 MB) a copy of the entire variable
or just the structure?  I don't want the time hit of a copy.

Many thanks,
-T


subs and variables speed question

2019-02-09 Thread ToddAndMargo via perl6-users

Hi All,

sub xxx( Buf $YugeBuf is ro ) {some midricle}

Is $YugeBuf (up to 100 MB) a copy of just the structure?
I don't want the time time of a copy.


Many thanks,
-T