Switch on int has constant time complexity, hasn't it?
On 28 Jan 2014 17:25, "Mehmet Dogan" <notifications@github.com> wrote:

> In
> hazelcast/src/main/java/com/hazelcast/concurrent/semaphore/SemaphoreDataSerializerHook.java:
>
> > @@ -31,6 +48,91 @@ public int getFactoryId() {
> >
> >      @Override
> >      public DataSerializableFactory createFactory() {
> > -        return null;
> > +        ConstructorFunction<Integer, IdentifiedDataSerializable> constructors[] = new ConstructorFunction[LEN];
>
> Problem with switch case approach is, if factory is huge then there will
> be a performance cost to find matching id. I was using array approach to
> avoid that.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/hazelcast/hazelcast/pull/1641/files#r9235444>
> .
>