BitField

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

BitField

abdelghani ALIDRA
Hi everybody,

I was discussing with Thibault about the performance of some methods defined on sets ( actually quite slow for big collections, mainly union: and intersection: ) and we were wondering if there is any implementation of some BitField-like class to speed up these operations? May be in an external project? 

Abdelghani
Reply | Threaded
Open this post in threaded view
|

Re: BitField

Marcus Denker-4
Hello,

You maybe can use Integers as bitfield:

bitField := 0 bitAt: 200 put: 1.

executing

 bitField bitAt: 200 

will return 1.

The only thing to take care is that it # bitAt:put does not change the object itself, but instead returns a new one.

Marcus

On 16 Nov 2015, at 17:16, abdelghani ALIDRA <[hidden email]> wrote:

Hi everybody,

I was discussing with Thibault about the performance of some methods defined on sets ( actually quite slow for big collections, mainly union: and intersection: ) and we were wondering if there is any implementation of some BitField-like class to speed up these operations? May be in an external project? 

Abdelghani

Reply | Threaded
Open this post in threaded view
|

Re: BitField

stepharo
In reply to this post by abdelghani ALIDRA
Have a look at the chapter on number in deep into pharo.
You get some illustrations of bit operations for numbers
    bitShift:
    bitAnd: ...

Stef

Le 16/11/15 21:16, abdelghani ALIDRA a écrit :
Hi everybody,

I was discussing with Thibault about the performance of some methods defined on sets ( actually quite slow for big collections, mainly union: and intersection: ) and we were wondering if there is any implementation of some BitField-like class to speed up these operations? May be in an external project? 

Abdelghani

Reply | Threaded
Open this post in threaded view
|

Re: BitField

abdelghani ALIDRA
In reply to this post by abdelghani ALIDRA

Thanks Stef. It Seems to be what  I am  looking for.

 Abdelghani


--------------------------------------------
En date de : Jeu 19.11.15, stepharo <[hidden email]> a écrit :

 Objet: Re: [Pharo-users] BitField
 À: "abdelghani ALIDRA" <[hidden email]>, "Any question about pharo is welcome" <[hidden email]>
 Date: Jeudi 19 novembre 2015, 20h57
 
 
     Have a look at the chapter on number in deep into
 pharo.
 
     You get some illustrations of bit operations for
 numbers
 
         bitShift:
 
         bitAnd: ...
 
     
 
     Stef
 
     
 
     Le 16/11/15
 21:16, abdelghani ALIDRA a
       écrit :
 
     
     
       
         Hi
 everybody,
         
 
         
         I was
           discussing with Thibault about the performance of
 some methods
           defined on sets ( actually quite slow for big
 collections,
           mainly union: and intersection: ) and we were
 wondering if
           there is any implementation of some BitField-like
 class to
           speed up these operations? May be in an external
 project? 
         
 
         
         Abdelghani