[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Thread-safe reference counting (modified dim-vector.h)
From: |
Jaroslav Hajek |
Subject: |
Re: Thread-safe reference counting (modified dim-vector.h) |
Date: |
Wed, 26 May 2010 20:19:14 +0200 |
On Wed, May 26, 2010 at 5:51 PM, Jarno Rajahalme
<address@hidden> wrote:
>
> On May 26, 2010, at 2:37 AM, ext Jaroslav Hajek wrote:
>
>>
>> But, by returning a reference, you require the referenced object to be
>> permanently stored somewhere. I think we absolutely do not want to
>> make such a requirement for octave_value::dims, objects should be
>> allowed to compute their dimensions on demand. Hence, making
>> octave_base_value::dims return a const reference is out of question.
>> If the need arises, we'll probably create an extra method for that.
>>
>
> I agree, and I did not intend to propose that octave_base_value::dims ()
> should be changed. My point was that when reference counting is made thread
> safe, the overheads become non-negligible.
>
>> Interestingly enough, using the original dim_vector.h and stripping
>> away the openmp stuff, the reference counting is so fast that there is
>> no visible difference:
>>
>
> I guess the back and forth changes stay mostly in the cache memory, are the
> caches are not synchronized at every change, nor are the changes committed to
> the main memory very often.
>
>> Another interesting point is that if
>> you make dims() return a dim_vector, both versions generate exactly
>> the same assembler output, suggesting that using a const reference
>> brings no advantage if a value is returned.
>>
>
> I would have expected this. But there is no disadvantage either?
>
Except the extra "&" needed, probably not. It feels less natural to me, however.
>> I'd say that the results of the test are not so bad. I expected worse.
>>
>
> You mean the atomic ref counting?
>
Yes.
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Changesets: Re: Parallel access to data created with Octave, (continued)
- Changesets: Re: Parallel access to data created with Octave, Jarno Rajahalme, 2010/05/25
- Re: Changesets: Re: Parallel access to data created with Octave, Jaroslav Hajek, 2010/05/25
- Re: Changesets: Re: Parallel access to data created with Octave, Michael D. Godfrey, 2010/05/25
- Re: Changesets: Re: Parallel access to data created with Octave, Jaroslav Hajek, 2010/05/25
- Re: Changesets: Re: Parallel access to data created with Octave, Michael D. Godfrey, 2010/05/25
- Re: Changesets: Re: Parallel access to data created with Octave, Jarno Rajahalme, 2010/05/25
- Re: Changesets: Re: Parallel access to data created with Octave, Jarno Rajahalme, 2010/05/25
- Thread-safe reference counting (modified dim-vector.h), Jarno Rajahalme, 2010/05/26
- Re: Thread-safe reference counting (modified dim-vector.h), Jaroslav Hajek, 2010/05/26
- Re: Thread-safe reference counting (modified dim-vector.h), Jarno Rajahalme, 2010/05/26
- Re: Thread-safe reference counting (modified dim-vector.h),
Jaroslav Hajek <=
- Re: Changesets: Re: Parallel access to data created with Octave, Jarno Rajahalme, 2010/05/25
- Re: Changesets: Re: Parallel access to data created with Octave, Jaroslav Hajek, 2010/05/26
- Re: Changesets: Re: Parallel access to data created with Octave, Jarno Rajahalme, 2010/05/26
- Re: Changesets: Re: Parallel access to data created with Octave, Jaroslav Hajek, 2010/05/27
- Re: Changesets: Re: Parallel access to data created with Octave, Jarno Rajahalme, 2010/05/27
- Re: Changesets: Re: Parallel access to data created with Octave, Jaroslav Hajek, 2010/05/28