Giter VIP home page Giter VIP logo

Comments (3)

peter-lawrey avatar peter-lawrey commented on August 19, 2024

The entry size should be a power of two regardless of what you give it. The
count will be a multiple of the number of segments. There should be checks
to enforce this but they might be broken.
On 29 Jan 2014 04:12, "sampath06" [email protected] wrote:

Modifying the existing testcase in HugeHashMapTest giving different values
of count makes it fail.

Sample code given below:

@Test
public void testPut() throws ExecutionException, InterruptedException {

    int count = 50;
    HugeConfig config = HugeConfig.DEFAULT.clone()
            .setSegments(128)
            .setSmallEntrySize(72) // TODO 64 corrupts the values !!
            .setCapacity(count);

    final HugeHashMap<CharSequence, SampleValues> map =
            new HugeHashMap<CharSequence, SampleValues>(
                    config, CharSequence.class, SampleValues.class);
    long start = System.nanoTime();


    final SampleValues value = new SampleValues();
    StringBuilder user = new StringBuilder();
    for (int i = 0; i < count; i++) {
        value.ee = i;
        value.gg = i;
        value.ii = i;
        map.put(users(user, i), value);
    }
    for (int i = 0; i < count; i++) {
        assertNotNull(map.get(users(user, i), value));
        assertEquals(i, value.ee);
        assertEquals(i, value.gg, 0.0);
        assertEquals(i, value.ii);
    }

    long time = System.nanoTime() - start;
    System.out.printf("Put/get %,d K operations per second%n",
            (int) (count * 4 * 1e6 / time));
}

The assertion is

java.lang.AssertionError: expected:<30> but was:<22>

With the count of 100, the assertion is

java.lang.AssertionError: expected:<40> but was:<32>

With count of 2000, the assertion is

java.lang.AssertionError: expected:<1247> but was:<1239>

Seems to work for other counts like 5000, 10000 etc.

Reply to this email directly or view it on GitHubhttps://github.com//issues/5
.

from hugecollections-old.

sampath06 avatar sampath06 commented on August 19, 2024

I tried with these values and it still gives the same error

int count = 32;
        HugeConfig config = HugeConfig.DEFAULT.clone()
                .setSegments(16)
                .setSmallEntrySize(128) // TODO 64 corrupts the values !!
                .setCapacity(count);

from hugecollections-old.

peter-lawrey avatar peter-lawrey commented on August 19, 2024

This needs investigating.
On 29 Jan 2014 08:20, "sampath06" [email protected] wrote:

I tried with these values and it still gives the same error
'''
int count = 32;
HugeConfig config = HugeConfig.DEFAULT.clone()
.setSegments(16)
.setSmallEntrySize(128) // TODO 64 corrupts the values !!
.setCapacity(count);
'''

Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-33564439
.

from hugecollections-old.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.